am 4ad4b860: am 704fe6bc: Make sure file paths are canonical in scanFile()
* commit '4ad4b8603cc0af86424e3224f683a35c96f88d21':
Make sure file paths are canonical in scanFile()
diff --git a/src/com/android/providers/media/MediaScannerService.java b/src/com/android/providers/media/MediaScannerService.java
index 46e5b2e..40bb10a 100644
--- a/src/com/android/providers/media/MediaScannerService.java
+++ b/src/com/android/providers/media/MediaScannerService.java
@@ -190,7 +190,14 @@
String volumeName = MediaProvider.EXTERNAL_VOLUME;
openDatabase(volumeName);
MediaScanner scanner = createMediaScanner();
- return scanner.scanSingleFile(path, volumeName, mimeType);
+ try {
+ // make sure the file path is in canonical form
+ String canonicalPath = new File(path).getCanonicalPath();
+ return scanner.scanSingleFile(canonicalPath, volumeName, mimeType);
+ } catch (Exception e) {
+ Log.e(TAG, "bad path " + path + " in scanFile()", e);
+ return null;
+ }
}
@Override