D7948: Only match real MIME types, not e.g. "raw CD image"

2017-09-23 Thread Nathaniel Graham
ngraham closed this revision.

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D7948

To: ngraham, #frameworks, nicolasfella, dfaure, kossebau, vhanda
Cc: #frameworks


D7948: Only match real MIME types, not e.g. "raw CD image"

2017-09-23 Thread Nathaniel Graham
ngraham updated this revision to Diff 19829.
ngraham added a comment.


  Grouping the startsWith() and contains() entries

REPOSITORY
  R293 Baloo

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D7948?vs=19827&id=19829

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D7948

AFFECTED FILES
  src/file/basicindexingjob.cpp

To: ngraham, #frameworks, nicolasfella, dfaure, kossebau, vhanda
Cc: #frameworks


D7948: Only match real MIME types, not e.g. "raw CD image"

2017-09-23 Thread Nathaniel Graham
ngraham added a comment.


  Ah, excellent idea.

REPOSITORY
  R293 Baloo

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D7948

To: ngraham, #frameworks, nicolasfella, dfaure, kossebau, vhanda
Cc: #frameworks


D7948: Only match real MIME types, not e.g. "raw CD image"

2017-09-23 Thread David Faure
dfaure accepted this revision.
dfaure added a comment.
This revision is now accepted and ready to land.


  Yes (although I would then swap document to be after text/, to have all the 
"groups" together, and then the "substring searches").
  In any case feel free to push.

REPOSITORY
  R293 Baloo

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D7948

To: ngraham, #frameworks, nicolasfella, dfaure, kossebau, vhanda
Cc: #frameworks


D7948: Only match real MIME types, not e.g. "raw CD image"

2017-09-23 Thread Nathaniel Graham
ngraham updated this revision to Diff 19827.
ngraham added a comment.


  Use startsWith() instead of contains() for greater speed and correctness, and 
do this for text MIME types as well

REPOSITORY
  R293 Baloo

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D7948?vs=19816&id=19827

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D7948

AFFECTED FILES
  src/file/basicindexingjob.cpp

To: ngraham, #frameworks, nicolasfella, dfaure, kossebau, vhanda
Cc: #frameworks


D7948: Only match real MIME types, not e.g. "raw CD image"

2017-09-23 Thread David Faure
dfaure added a comment.


  Yes, but then startsWith() would be even more correct (and slightly faster) 
than contains().
  
  And application/vnd.oasis.opendocument.text isn't plain text, so 
contains("text") should also be changed to startsWith("text/").

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D7948

To: ngraham, #frameworks, nicolasfella, dfaure, kossebau, vhanda
Cc: #frameworks


D7948: Only match real MIME types, not e.g. "raw CD image"

2017-09-22 Thread Nathaniel Graham
ngraham added reviewers: Frameworks, nicolasfella, dfaure, kossebau, vhanda.

REPOSITORY
  R293 Baloo

REVISION DETAIL
  https://phabricator.kde.org/D7948

To: ngraham, #frameworks, nicolasfella, dfaure, kossebau, vhanda
Cc: #frameworks


D7948: Only match real MIME types, not e.g. "raw CD image"

2017-09-22 Thread Nathaniel Graham
ngraham created this revision.
Restricted Application added a project: Frameworks.
Restricted Application added a subscriber: Frameworks.

REVISION SUMMARY
  BUG: 364884
  
  Only match real MIME types when doing string matching to prevent pulling in 
unrelated files whose types match the string.
  
  This prevents weird situations such as ISO files (which show up as "raw CD 
image") appearing in image searches.

TEST PLAN
  - Confirmed at www.mime-type.net/ that all audio, video, and image MIME types 
have the key word before the slash (e.g. "image/")
  - Booted a clean KDE Neon VM and added an ISO and a bunch of pictures of 
various types
  - Confirmed the problem: `baloosearch -t image iso` shows ISO files
  - Patched and rebuilt Baloo
  - Forced a re-index operation (balooctl disable; rm 
~/.local/share/baloo/index*; balooctl enable)
  - Did a new image search (`baloosearch -t image iso`) and confirmed that the 
ISO does not show up
  - Confirmed that other images still show up

REPOSITORY
  R293 Baloo

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D7948

AFFECTED FILES
  src/file/basicindexingjob.cpp

To: ngraham
Cc: #frameworks