Convert URI scheme to lower case before checking if it is a file.
This fixes an edge case where a "File://" style URI could be passed in
but not pass this check, even though the underlying framework recognizes
this as a legitimate file.
Bug: 197328178
Test: See repro steps on http://b/197328178, was no longer able to
repro.
Change-Id: Id837744a79d1aca91b41d24207dc9b98f2b5b5e9
(cherry picked from commit 9607c95e71)
This commit is contained in:
@@ -94,8 +94,12 @@ public class UriUtil {
|
||||
return TextUtils.equals(scheme, ContentResolver.SCHEME_ANDROID_RESOURCE);
|
||||
}
|
||||
|
||||
/** Returns whether the given Uri is a file. */
|
||||
public static boolean isFileUri(final Uri uri) {
|
||||
return uri != null && TextUtils.equals(uri.getScheme(), ContentResolver.SCHEME_FILE);
|
||||
return uri != null &&
|
||||
uri.getScheme() != null &&
|
||||
TextUtils.equals(uri.getScheme().toLowerCase(),
|
||||
ContentResolver.SCHEME_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user