Verified Commit 5ec00db7 authored by p13dz's avatar p13dz Committed by ma1
Browse files

BB 40283: Workaround for the file upload bug

parent 53bf5fc9
Loading
Loading
Loading
Loading
+9 −2
Changes for mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -6338,12 +6338,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 =
@@ -6365,7 +6372,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) {
            }