summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@cyngn.com>2016-04-04 17:47:50 -0700
committerJessica Wagantall <jwagantall@cyngn.com>2016-04-04 17:47:50 -0700
commite4355e3f26007680622b39c60a9595aeb6025de5 (patch)
treede7b587d64dc9527b670a62400a7f461d7a82bc9
parentc663206d84ad72d0ddf5527e93483971800655b2 (diff)
parent5110b8a656b42f008aa225acd3b359a8b8b5dcec (diff)
downloadandroid_packages_providers_DownloadProvider-e4355e3f26007680622b39c60a9595aeb6025de5.tar.gz
android_packages_providers_DownloadProvider-e4355e3f26007680622b39c60a9595aeb6025de5.tar.bz2
android_packages_providers_DownloadProvider-e4355e3f26007680622b39c60a9595aeb6025de5.zip
Merge tag 'android-5.1.1_r37' into HEAD
Ticket: CYNGNOS-2213 Android 5.1.1 release 37
-rw-r--r--src/com/android/providers/downloads/DownloadProvider.java10
-rw-r--r--src/com/android/providers/downloads/Helpers.java1
2 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java
index 4b23024f..2d914c41 100644
--- a/src/com/android/providers/downloads/DownloadProvider.java
+++ b/src/com/android/providers/downloads/DownloadProvider.java
@@ -1230,9 +1230,15 @@ public final class DownloadProvider extends ContentProvider {
throw new FileNotFoundException("No filename found.");
}
- final File file = new File(path);
+ final File file;
+ try {
+ file = new File(path).getCanonicalFile();
+ } catch (IOException e) {
+ throw new FileNotFoundException(e.getMessage());
+ }
+
if (!Helpers.isFilenameValid(getContext(), file)) {
- throw new FileNotFoundException("Invalid file: " + file);
+ throw new FileNotFoundException("Invalid file path: " + file);
}
final int pfdMode = ParcelFileDescriptor.parseMode(mode);
diff --git a/src/com/android/providers/downloads/Helpers.java b/src/com/android/providers/downloads/Helpers.java
index 0aa49c0a..1b4c911e 100644
--- a/src/com/android/providers/downloads/Helpers.java
+++ b/src/com/android/providers/downloads/Helpers.java
@@ -341,7 +341,6 @@ public class Helpers {
static boolean isFilenameValid(Context context, File file) {
final File[] whitelist;
try {
- file = file.getCanonicalFile();
whitelist = new File[] {
context.getFilesDir().getCanonicalFile(),
context.getCacheDir().getCanonicalFile(),