Merge "Update buckets after path changes." into jb-mr1-dev
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