File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
app/src/main/java/com/owncloud/android/utils Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -73,13 +73,24 @@ public final class FileStorageUtils {
73
73
private FileStorageUtils () {
74
74
// utility class -> private constructor
75
75
}
76
+ // Safely decodes URLs without crashing on '%' patterns
77
+ private static String safeUrlDecode (String s ){
78
+ try {
79
+ return java .net .URLDecoder .decode (s , StandardCharsets .UTF_8 .name ());
80
+ }
81
+ catch (IllegalArgumentException e ){
82
+ // If the text has invalid % sequences (like "65% on ..."), return as-is
83
+ return s ;
84
+ }
85
+ }
86
+
76
87
77
88
public static boolean containsBidiControlCharacters (String filename ) {
78
89
if (filename == null ) return false ;
79
90
80
91
String decoded ;
81
92
try {
82
- decoded = URLDecoder . decode (filename , StandardCharsets . UTF_8 . toString () );
93
+ decoded = safeUrlDecode (filename );
83
94
} catch (UnsupportedEncodingException e ) {
84
95
return false ;
85
96
}
You can’t perform that action at this time.
0 commit comments