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
Copy Markdown
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
@VishnuSanal VishnuSanal added the PR-Awaiting-Initial-Review this PR is awaiting for an initial review label Mar 21, 2026
Copy link
Copy Markdown
Member

@VishnuSanal VishnuSanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀 thanks!

@VishnuSanal VishnuSanal added PR-Awaiting-Final-Review this PR is awaiting a final review/approval and removed PR-Awaiting-Initial-Review this PR is awaiting for an initial review labels Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR-Awaiting-Final-Review this PR is awaiting a final review/approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants