File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
app/src/main/java/com/amaze/filemanager/filesystem/files Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -968,8 +968,20 @@ public static boolean isRoot(
968968
969969 /** Convenience method to return if a path points to a compressed file. */
970970 public static boolean isCompressedFile (String path ) {
971- @ Nullable String extension = MimeTypes .getExtension (path );
972- return ArraysKt .indexOf (COMPRESSED_FILE_EXTENSIONS , extension ) > -1 ;
971+ if (path == null ) return false ;
972+
973+ // Normalize input: trim leading/trailing whitespace first
974+ String normalizedPath = path .trim ();
975+ if (normalizedPath .isEmpty ()) return false ;
976+
977+ // Extract extension using MimeTypes helper, then normalize it
978+ String extension = MimeTypes .getExtension (normalizedPath );
979+ if (!extension .isEmpty ()) {
980+ extension = extension .trim ().toLowerCase (Locale .getDefault ());
981+ return ArraysKt .indexOf (COMPRESSED_FILE_EXTENSIONS , extension ) > -1 ;
982+ }
983+
984+ return false ;
973985 }
974986
975987 /** Converts ArrayList of HybridFileParcelable to ArrayList of File */
You can’t perform that action at this time.
0 commit comments