Skip to content

Conversation

@mgutt
Copy link
Contributor

@mgutt mgutt commented Jan 11, 2026

  • Fix false error 'Cannot move directory into its own subdirectory' when moving files (not directories) to subdirectories

  • Fixed additional bug: Preserve empty directories during rsync rename operations (rsync --backup deletes empty dirs, so copy them first with find+rsync)

Fixes #2510

Summary by CodeRabbit

  • Bug Fixes

    • Prevents moving a directory into its own subdirectory by tightening move validation
    • Better handling of empty directories during complex moves to avoid data loss or inconsistencies
    • Improved reliability and safety for multi-step move/rename operations
  • Refactor

    • Reworked internal move/transfer workflow for safer, more robust execution while preserving external behavior

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

Walkthrough

The pull request tightens directory-move validation (only checking subdirectory relation when the source is a directory) and rewrites the rsync-based move into a two-step, heredoc-driven bash flow that copies empty directories first, then performs a safe rsync/rename with extensive variable escaping.

Changes

Cohort / File(s) Summary
Move Operation & Rsync Logic
emhttp/plugins/dynamix/nchan/file_manager
Conditional subdirectory validation (only for directory sources); new rsync-based move: builds relative source paths, copies empty directories first, then runs a renamed rsync move in a single heredoc bash block with careful escaping, variable prep, and comments supporting empty-dir/backup-dir handling.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 I hop through paths both near and far,
I copy holes and then rename each star,
With quoted vars and bash so spry,
No dir becomes its own goodbye. 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the two main objectives: fixing issue #2510 (the false error on directory moves) and preserving empty directories during move operations, which are the primary changes documented in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Jan 11, 2026

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.01.11.2259
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2516/webgui-pr-2516.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix/nchan/file_manager

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2516, or run:

plugin remove webgui-pr-2516

🤖 This comment is automatically generated and will be updated with each new push to this PR.

- Fix false error 'Cannot move directory into its own subdirectory'
  when moving files (not directories) to subdirectories
- Preserve empty directories during rsync rename operations
  (rsync --backup deletes empty dirs, so copy them first with find+rsync)
@mgutt mgutt marked this pull request as ready for review January 11, 2026 22:59
@mgutt
Copy link
Contributor Author

mgutt commented Jan 12, 2026

@limetech
Will the new emhttp add fsMountpoint to Disks.ini? Because the API response of /sub/devices does not contain the dir= value for the disk overview and I think it is because I don't have the most recent emhttp on my test server.

image image

Copy link
Contributor

@SimonFair SimonFair left a comment

Choose a reason for hiding this comment

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

Approved

@SimonFair SimonFair added the 7.3 label Jan 13, 2026
@limetech limetech merged commit 523e659 into unraid:master Jan 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File Manager: Wrong error "Cannot move into its own subdirectory"

3 participants