Richard Pospesel pushed to branch base-browser-102.7.0esr-12.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
f8403767
by p13dz at 2023-02-01T14:22:02+00:00
1 changed file:
Changes:
... | ... | @@ -4726,12 +4726,19 @@ public class GeckoSession { |
4726 | 4726 | return super.confirm();
|
4727 | 4727 | }
|
4728 | 4728 | |
4729 | + private static String normalizePath(String input) {
|
|
4730 | + // For an unclear reason, Android media picker delivers file paths
|
|
4731 | + // starting with double slash. Firefox performs path validation on
|
|
4732 | + // all paths, and double slash is deemed invalid.
|
|
4733 | + return input.startsWith("//") ? input.substring(1) : input;
|
|
4734 | + }
|
|
4735 | + |
|
4729 | 4736 | private static String getFile(final @NonNull Context context, final @NonNull Uri uri) {
|
4730 | 4737 | if (uri == null) {
|
4731 | 4738 | return null;
|
4732 | 4739 | }
|
4733 | 4740 | if ("file".equals(uri.getScheme())) {
|
4734 | - return uri.getPath();
|
|
4741 | + return normalizePath(uri.getPath());
|
|
4735 | 4742 | }
|
4736 | 4743 | final ContentResolver cr = context.getContentResolver();
|
4737 | 4744 | final Cursor cur =
|
... | ... | @@ -4753,7 +4760,7 @@ public class GeckoSession { |
4753 | 4760 | try {
|
4754 | 4761 | final String path = cur.getString(idx);
|
4755 | 4762 | if (path != null && !path.isEmpty()) {
|
4756 | - return path;
|
|
4763 | + return normalizePath(path);
|
|
4757 | 4764 | }
|
4758 | 4765 | } catch (final Exception e) {
|
4759 | 4766 | }
|