[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



Title: GitLab

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:

Changes:

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

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits