Skip to content

fix: Mitigate Android ERR_UPLOAD_FILE_CHANGE errors#224

Merged
dcalhoun merged 12 commits into
trunkfrom
fix/mitigate-android-file-changes-errors
Nov 12, 2025
Merged

fix: Mitigate Android ERR_UPLOAD_FILE_CHANGE errors#224
dcalhoun merged 12 commits into
trunkfrom
fix/mitigate-android-file-changes-errors

Conversation

@dcalhoun
Copy link
Copy Markdown
Member

@dcalhoun dcalhoun commented Nov 11, 2025

What?

Mitigate ERR_UPLOAD_FILE_CHANGE errors occurring when uploading files selected from a cloud-based content provider on Android.

Why?

Fix CMM-782. Due to a Chrome bug, uploading media often failed if the file was provided by a cloud-based content provider (e.g., the Google Drive app). The error is almost always thrown, but generally only causes video (or larger) file uploads to fail.

This issue is also noted in the tus-js-client project, which is used by VideoPress. The ERR_UPLOAD_FILE_CHANGE error occurs for most all media uploads (images, videos, etc), but seemingly mostly causes VideoPress uploads to fail, likely due to the tus usage.

The ERR_UPLOAD_FILE_CHANGE error is also not thrown when using GutenbergKit/VideoPress from the Chrome browser directly. It only occurs in the Android WebView.

How?

Cache the selected file and upload it rather than the reference provided by the cloud-based content provider. This mirrors a workaround suggested on the Chrome issue tracker.

We clear the cached files when the editor is destroyed to avoid a ballooning cache.

Testing Instructions

Note

Prior to the changes, the Android demo app did not have logic in place for handling the file picker. To replicate the original failures, you can checkout the first commit of this branch.

Tip

The WordPress-Android prototype build can be used for testing.

  1. Insert a Video block.
  2. Tap Upload.
  3. Select a video file from a cloud-based content provider (often times the default picker is driven by a cloud-based provider).
  4. Verify the upload succeeds.

Accessibility Testing Instructions

N/A no navigation changes.

Screenshots or screencast

Screen_Recording_20251111_154024_GutenbergKit.mp4

A Chrome bug results in `ERR_UPLOAD_FILE_CHANGED` errors when selecting
a file from a cloud content provider (e.g., the Google Drive app). This
does not disrupt all file uploads--e.g., images--but larger files (e.g.,
videos) and resumable uploads often fail.

Caching the selected file ensures the file remains stable throughout the
Chrome upload process.

See: https://issues.chromium.org/issues/40123366
@dcalhoun dcalhoun added the [Type] Bug An existing feature does not function as intended label Nov 11, 2025
Avoid unnecessary CPU and disk usage for providers that succeed without
caching.
The editor uploads numerous file types.
Avoid OOM from attempts to cache large files.
Avoid stale files after closing the editor.
Simplify the API for uploading selected files in GutenbergKit.
Enable host apps to act on extracted URIs as before.
Copy link
Copy Markdown
Contributor

@adalpari adalpari left a comment

Choose a reason for hiding this comment

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

The code looks solid. Tested it here, and it's working as expected! :shipit:

PS: Thanks for the video, it helps to quickly understand testing steps if there's anything the tester is not familiar with.

@dcalhoun dcalhoun merged commit a3a4b08 into trunk Nov 12, 2025
11 checks passed
@dcalhoun dcalhoun deleted the fix/mitigate-android-file-changes-errors branch November 12, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants