Skip to content

fix(fs): fall back to copying when move() is not allowed in OPFS - #97

Merged
alex-titarenko merged 3 commits into
mainfrom
claude/move-fallback-not-allowed
Dec 4, 2026
Merged

alex-titarenko merged 3 commits into
mainfrom
claude/move-fallback-not-allowed

Conversation

@alex-titarenko

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Performance improvements
  • Missing tests
  • Other... Please describe:

What is the current behavior?

On Chromium 124 and older, FileSystemAccessApiFsClient.rename fails with NotAllowedError: The request is not allowed by the user agent or the platform in the current context. Those versions expose FileSystemFileHandle.move() in the origin private file system but reject every call. Since 1.6.13, renameFile uses move() whenever it exists, so clone and pull fail 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 with NotAllowedError, renameFile falls back to the existing streaming copy, as it did before move() was used. The client remembers this in a static flag, so later renames in the same session skip move() instead of failing first every time. Any other move() error is still thrown. Browsers where move() works are unchanged.

New tests in tests/FileSystemAccessApiFsClient.test.ts drive the client against a small in-memory OPFS stand-in (tests/helpers/fakeOpfs.ts): move works, move is rejected with NotAllowedError, later renames skip move(), move is missing, and other errors are rethrown. All 238 tests pass and npm run check is clean.

Screenshots

The same rename in OPFS from a web worker, bundled from main and from this branch.

Chrome 114 (main fails, this branch works):

Chrome 114

Chrome 131 (both work, no change):

Chrome 131

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?

  • Yes
  • No

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

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>
@alex-titarenko
alex-titarenko merged commit 6085adc into main Dec 4, 2026
1 check passed
@alex-titarenko
alex-titarenko deleted the claude/move-fallback-not-allowed branch December 4, 2026 00:38
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.6.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

2 participants