Repository navigation
fix(organize): stop losing identical files, report move outcomes, allow external drives - #122
Merged
Merged
Conversation
…ow external drives From a tester's report of a Mac sorting run that ended with files missing, an unclear result and an external drive that could not be used. File loss - handleDuplicateMove compared a file against files the same run had still to move. Two byte-identical files renamed or moved in one run were each taken for a copy already in place, both went to the trash, the move check failed and the run was undone with the two files gone. A file the run has still to move no longer counts as a copy in place, and a rename inside one folder never removes the file. Move outcomes - A run that did not move everything stays on Organize with a banner: how many moved, how many did not and why, or that the run was undone. - Identical copies that were removed are listed as duplicates with the copy that was kept, and are no longer counted as moved. Sources that are also destinations - A notice on Organize and a mark in Preview say which files stay where they are, or are only renamed there. External drives - A folder outside the user folder can be a Smart Folder, can be scanned and can have folders created in it. sanitizeFolderPath no longer bounds paths to the home tree; the destination policy decides, and asks once for a folder that is not inside a Smart Folder or Documents and was not picked in a dialog. - Still refused: system folders and links into them, startup folders, device paths and traversal. LINK_OUTSIDE_ALLOWED becomes LINK_INTO_SYSTEM; ALLOWED_APP_PATHS is removed. - A refused or unreadable folder on Discover gives the reason instead of "No files found". Not changed: one file failing the move check still undoes the whole run. Not verified: macOS, and a packaged build of this branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes for the first five items of a tester's report of a Mac sorting run: files went missing, the result was unclear, and a folder on an external drive could not be added.
What changes
1. Identical files were lost (data loss)
Two byte-identical files that one run renamed or moved were each taken for a copy of the other that was already in place. Both went to the system trash, the move check failed with "destination does not exist after move", and the run was undone with the two files missing.
handleDuplicateMove(src/main/utils/fileDedup.js) now ignores files the same run has still to move, and a rename inside one folder never removes the file.2. The result of a run is stated
A run that did not move everything stays on Organize with a banner: how many files moved, how many did not and why, or that the run was undone. Identical copies that were removed are listed as duplicates with the copy that was kept, and are not counted as moved.
3. A source folder that is also a destination
A notice on Organize and a mark in Preview say which files stay where they are, or are only renamed there.
4. External and second drives
A folder outside the user folder can be a Smart Folder, can be scanned, and can have folders created in it.
sanitizeFolderPathno longer bounds paths to the home tree; the destination policy decides, and asks once for a folder that is not inside a Smart Folder or Documents and was not picked in a file dialog. A refused or unreadable folder on Discover now gives the reason instead of "No files found".Behaviour changes to review
..escapes. Folder scans outside the home tree run without a prompt (reads only). The stricter alternative is to prompt unless the folder is a Smart Folder or was picked in a dialog.LINK_OUTSIDE_ALLOWEDis renamedLINK_INTO_SYSTEM, and theALLOWED_APP_PATHSexport is removed. Neither has a remaining reference.Not changed
Tested
Local, Windows 11 x64, on this commit's tree:
npm run local:gate: every step passed. Jest with coverage: 955 suites, 14089 tests passed, 11 skipped, thresholds met. Production build andverify:native-modulespassed.e2e-smokespecs, 101 of 101 passed; five more setup and discover specs that use the changed folder paths, 81 of 81 passed.mainand moved all 38 on this branch. Add, scan and create-folder work on the drive. A link intoC:\Windows,System Volume Informationand a..escape are refused with no prompt and nothing created.Not verified