Skip to content

Commit 1e855d9

Browse files
author
Mike Lockwood
committed
MtpDatabase: Fix sqlite3 pattern matching for MTP directory deletes
Bug: 6684451 Change-Id: I90204550ccfcd1b7a5b1973bed2a88e934aae053 Signed-off-by: Mike Lockwood <lockwood@google.com>
1 parent dbbfa70 commit 1e855d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

media/java/android/mtp/MtpDatabase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,10 +933,10 @@ private int deleteFile(int handle) {
933933
// recursive case - delete all children first
934934
Uri uri = Files.getMtpObjectsUri(mVolumeName);
935935
int count = mMediaProvider.delete(uri,
936-
// the 'like' makes it use the index, the 'lower()' makes it correct
937-
// when the path contains sqlite wildcard characters
938-
"_data LIKE ? AND lower(substr(_data,?))=lower(?)",
939-
new String[] { path + "/%", "" + path.length() + 1, path + "/"});
936+
// the 'like' makes it use the index, the 'lower()' makes it correct
937+
// when the path contains sqlite wildcard characters
938+
"_data LIKE ?1 AND lower(substr(_data,1,?2))=lower(?3)",
939+
new String[] { path + "/%",Integer.toString(path.length() + 1), path + "/"});
940940
}
941941

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

0 commit comments

Comments
 (0)