AmazeFileManager icon indicating copy to clipboard operation
AmazeFileManager copied to clipboard

`StringIndexOutOfBoundsException` on `CompressedHelper#getFileName`

Open amaze-issue-automation[bot] opened this issue 10 months ago • 4 comments

Issue explanation (write below this line)

Exception

  • App Name: Amaze File Manager
  • Package: com.amaze.filemanager
  • Version: 3.10
  • User Action: UI Error
  • Request: Application crash
  • OS: Linux Android 14 - 34
  • Device: OP533FL1
  • Model: CPH2363
  • Product: CPH2363T2
Crash log

java.lang.RuntimeException: An error occurred while executing
doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:415)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
at java.util.concurrent.FutureTask.run(FutureTask.java:269)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end -1,
length 3
at java.lang.String.checkBoundsBeginEnd(String.java:4466)
at java.lang.String.substring(String.java:2517)
at
com.amaze.filemanager.filesystem.compressed.CompressedHelper.getFileName(CompressedHelper.java:218)
at
com.amaze.filemanager.asynchronous.services.ExtractService$DoWork.doInBackground(ExtractService.java:258)
at
com.amaze.filemanager.asynchronous.services.ExtractService$DoWork.doInBackground(ExtractService.java:234)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
... 4 more


I have found the steps to reproduce the issue and though it is very straight forward, it exposes a major issue in whole codebase. Please refer to following video. @VishnuSanal

https://github.com/TeamAmaze/AmazeFileManager/assets/32137513/51f17b79-e496-48f7-b938-b28604b51b83

pratikmhatre avatar May 21 '24 11:05 pratikmhatre

@VishnuSanal

Please refer video rec below, the app treats every file ending with any of zip/tar/7z/rar as a compressed file and and shows extract option for it, even though there is no . separating the filename and the extension.

https://github.com/TeamAmaze/AmazeFileManager/assets/32137513/8551ece9-0f54-41d4-9a90-3e72a84169e4

pratikmhatre avatar May 21 '24 11:05 pratikmhatre

Yep, thanks for the investigation! Must be some issue with us parsing the name/extension.

VishnuSanal avatar May 21 '24 11:05 VishnuSanal

Awch... so edge case :melting_face:

A quick reference from my Linux Mint Cinnamon using FileRoller: if extracting an archive without file extension, the directory name becomes <archive name>_FILES

i.e. when the archive is named foobar extracting it FileRoller will create foobar_FILES then put the archive contents inside.

TranceLove avatar May 21 '24 15:05 TranceLove