TeamAmaze / AmazeFileManager

Material design file manager for Android
https://teamamaze.xyz
GNU General Public License v3.0
5.36k stars 1.58k forks source link

`IndexOutOfBoundsException` on `NetCopyConnectionInfo.#init` #4148

Open amaze-issue-automation[bot] opened 7 months ago

amaze-issue-automation[bot] commented 7 months ago

Issue explanation (write below this line)

trying to copy an image fromage smb nas serveur to local storage. bug when asking to paste.

Exception

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
    at java.util.Collections$SingletonList.get(Collections.java:5042)
    at com.amaze.filemanager.filesystem.ftp.NetCopyConnectionInfo.<init>(NetCopyConnectionInfo.kt:118)
    at com.amaze.filemanager.utils.smb.SmbUtil.buildPath(SmbUtil.kt:80)
    at com.amaze.filemanager.utils.smb.SmbUtil.getSmbDecryptedPath(SmbUtil.kt:59)
    at com.amaze.filemanager.utils.smb.SmbUtil.create(SmbUtil.kt:105)
    at com.amaze.filemanager.filesystem.HybridFile.getSmbFile(HybridFile.java:521)
    at com.amaze.filemanager.ui.fragments.MainFragment.goBack(MainFragment.java:1097)
    at com.amaze.filemanager.ui.activities.MainActivity.lambda$onBackPressed$6(MainActivity.java:932)
    at com.amaze.filemanager.ui.activities.MainActivity.$r8$lambda$fKbQXJTjmE3tEXFhvzq2Q8y2c_E(Unknown Source:0)
    at com.amaze.filemanager.ui.activities.MainActivity$$ExternalSyntheticLambda2.apply(Unknown Source:2)
    at com.amaze.filemanager.ui.activities.MainActivity.executeWithMainFragment(MainActivity.java:2553)
    at com.amaze.filemanager.ui.activities.MainActivity.executeWithMainFragment(MainActivity.java:2545)
    at com.amaze.filemanager.ui.activities.MainActivity.onBackPressed(MainActivity.java:930)
    at android.app.Activity.onKeyUp(Activity.java:3920)
    at android.view.KeyEvent.dispatch(KeyEvent.java:2925)
    at android.app.Activity.dispatchKeyEvent(Activity.java:4298)
    at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:126)
    at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:86)
    at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:144)
    at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:604)
    at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:60)
    at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:3413)
    at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:444)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6821)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6682)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6133)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6195)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6156)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6330)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6164)
    at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6387)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6137)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6195)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6156)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6164)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6137)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6195)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6156)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6363)
    at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6543)
    at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3778)
    at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:3291)
    at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:3282)
    at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3755)
    at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:154)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:339)
    at android.os.Looper.loopOnce(Looper.java:186)
    at android.os.Looper.loop(Looper.java:351)
    at android.app.ActivityThread.main(ActivityThread.java:8377)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)


__̴ı ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡| ̲▫̲͡ π ̲̲͡▫ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l.___

Tey commented 1 month ago

I have the same problem with one of my samba share that requires a username but no password. It always happens when copying files to a subfolder of that network share, but not when copying files to the share root. It also happens when trying to create a new file/folder in a share subfolder. It does not seem to happen with my other shares (but they use different credentials).

Most likely, the split here returns a list of a single element, so accessing pair[1] crashes. You probably want to use pair.elementAtOrElse(1, "") instead. That code appeared in #3661.