[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-102.7.0esr-12.0-1] Bug 40283: Workaround for the file upload bug

Richard Pospesel (@richard) git at gitlab.torproject.org
Wed Feb 1 14:21:41 UTC 2023



Richard Pospesel pushed to branch tor-browser-102.7.0esr-12.0-1 at The Tor Project / Applications / Tor Browser


Commits:
97cd9671 by p13dz at 2023-02-01T14:21:34+00:00
Bug 40283: Workaround for the file upload bug


(cherry picked from commit c23f2f397327ee46a1a4de57acf206fd83e8e170)
- - - - -


1 changed file:

- mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java


Changes:

=====================================
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
=====================================
@@ -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) {
             }



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/97cd9671c1844d25b7529bcc72c9d767abf7fdb3

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/97cd9671c1844d25b7529bcc72c9d767abf7fdb3
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tor-commits/attachments/20230201/20558085/attachment-0001.htm>


More information about the tor-commits mailing list