Skip to content
Snippets Groups Projects
Commit c23f2f39 authored by p13dz's avatar p13dz Committed by Richard Pospesel
Browse files

Bug 40283: Workaround for the file upload bug

parent 003fb2fe
Branches
No related tags found
1 merge request!493Bug 40283: Workaround for the file upload bug
......@@ -4726,12 +4726,19 @@ public class GeckoSession {
return super.confirm();
}
private static String normalizePath(String input) {
// For an unclear reason, Android media picker delivers file paths
// starting with double slash. Firefox performs path validation on
// all paths, and double slash is deemed invalid.
return input.startsWith("//") ? input.substring(1) : input;
}
private static String getFile(final @NonNull Context context, final @NonNull Uri uri) {
if (uri == null) {
return null;
}
if ("file".equals(uri.getScheme())) {
return uri.getPath();
return normalizePath(uri.getPath());
}
final ContentResolver cr = context.getContentResolver();
final Cursor cur =
......@@ -4753,7 +4760,7 @@ public class GeckoSession {
try {
final String path = cur.getString(idx);
if (path != null && !path.isEmpty()) {
return path;
return normalizePath(path);
}
} catch (final Exception e) {
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment