Skip to content

Fix file rename in drawer views#4584

Open
geoffreysisco wants to merge 1 commit intoTeamAmaze:release/4.0from
geoffreysisco:fix/failed-drawer-rename-file
Open

Fix file rename in drawer views#4584
geoffreysisco wants to merge 1 commit intoTeamAmaze:release/4.0from
geoffreysisco:fix/failed-drawer-rename-file

Conversation

@geoffreysisco
Copy link
Contributor

@geoffreysisco geoffreysisco commented Mar 13, 2026

Use file mode and parent directory from the selected item when invoking rename instead of fragment navigation state.

Description

Rename from drawer views such as Audios and APKs failed with Operation Unsuccessful even though renaming the same files from a normal directory worked.

MainFragment.rename() was using fragment navigation state when invoking rename:

  • mainFragmentViewModel.getOpenMode()
  • mainFragmentViewModel.getCurrentPath()

In drawer views, those values represent virtual drawer/category state rather than the selected file's actual filesystem context.

This change uses the selected item's:

  • file mode via f.getMode()
  • parent directory via new File(f.getPath()).getParent()

Rename now resolves against the actual filesystem path.

Issue tracker

Fixes #4560

Automatic tests

  • Added test cases

Manual tests

  • Done

  • Device: Pixel 9 Pro emulator

  • OS: Android 16

  • Rooted: No

  • Version: 3.11.2

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembleDebug
  • ./gradlew spotlessCheck

Use file mode and parent directory from the selected item when
invoking rename instead of fragment navigation state.
@geoffreysisco geoffreysisco force-pushed the fix/failed-drawer-rename-file branch from f8cd402 to 5c69d7f Compare March 13, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename not work in "Audios", "APKs", etc.

1 participant