Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 738342b1 authored by Marco Nelissen's avatar Marco Nelissen Committed by Android Git Automerger
Browse files

am ec1d16bf: am 101fb9fe: Merge "Handle _ and % in paths" into jb-dev

* commit 'ec1d16bf':
  Handle _ and % in paths
parents 997c952f ec1d16bf
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1444,7 +1444,9 @@ public class MediaScanner
        String where;
        String[] selectionArgs;
        if (mCaseInsensitivePaths) {
            where = Files.FileColumns.DATA + " LIKE ?";
            // the 'like' makes it use the index, the 'lower()' makes it correct
            // when the path contains sqlite wildcard characters
            where = "_data LIKE ?1 AND lower(_data)=lower(?1)";
            selectionArgs = new String[] { path };
        } else {
            where = Files.FileColumns.DATA + "=?";
+5 −2
Original line number Diff line number Diff line
@@ -932,8 +932,11 @@ public class MtpDatabase {
            if (format == MtpConstants.FORMAT_ASSOCIATION) {
                // recursive case - delete all children first
                Uri uri = Files.getMtpObjectsUri(mVolumeName);
                int count = mMediaProvider.delete(uri, "_data LIKE ?",
                        new String[] { path + "/%"});
                int count = mMediaProvider.delete(uri,
                        // the 'like' makes it use the index, the 'lower()' makes it correct
                        // when the path contains sqlite wildcard characters
                        "_data LIKE ? AND lower(substr(_data,?))=lower(?)",
                        new String[] { path + "/%", "" + path.length() + 1, path + "/"});
            }

            Uri uri = Files.getMtpObjectsUri(mVolumeName, handle);