Repository navigation
fix(fs): fall back to copying when move() is not allowed in OPFS - #97
Merged
Merged
Conversation
Chromium 124 and older (and Android WebViews that can't be updated, such as Huawei phones without Google Play) expose FileSystemFileHandle.move() in the origin private file system but reject every call with NotAllowedError. Since rename started using move(), clone and pull fail there when the downloaded packfile is renamed. When move() rejects with NotAllowedError, remember it for the session and use the streaming copy instead, as before move() was used. Other move() errors are still thrown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.6.14 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
On Chromium 124 and older,
FileSystemAccessApiFsClient.renamefails withNotAllowedError: The request is not allowed by the user agent or the platform in the current context.Those versions exposeFileSystemFileHandle.move()in the origin private file system but reject every call. Since 1.6.13,renameFileusesmove()whenever it exists, socloneandpullfail when they rename the downloaded packfile.This reached a NotesHub user on a Huawei phone whose Android WebView is stuck on Chrome 114 (no Google Play to update it). Tested with Chrome for Testing: 114, 116, 119, 122, 123 and 124 reject all
move()calls; 125 and later work.Issue Number: N/A
What is the new behavior?
If
move()rejects withNotAllowedError,renameFilefalls back to the existing streaming copy, as it did beforemove()was used. The client remembers this in a static flag, so later renames in the same session skipmove()instead of failing first every time. Any othermove()error is still thrown. Browsers wheremove()works are unchanged.New tests in
tests/FileSystemAccessApiFsClient.test.tsdrive the client against a small in-memory OPFS stand-in (tests/helpers/fakeOpfs.ts): move works, move is rejected withNotAllowedError, later renames skipmove(), move is missing, and other errors are rethrown. All 238 tests pass andnpm run checkis clean.Screenshots
The same rename in OPFS from a web worker, bundled from
mainand from this branch.Chrome 114 (
mainfails, this branch works):Chrome 131 (both work, no change):
No preview link: this is a library change. The screenshots were committed and removed again on this branch so the diff stays clean.
Does this PR introduce a breaking change?
Other information
The real Android WebView 114 wasn't run here (no Android emulator available), but desktop Chrome 114 throws exactly the error the NotesHub user's diagnostics show.
Generated by Claude Code