fix: Mitigate Android ERR_UPLOAD_FILE_CHANGE errors#224
Merged
Conversation
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
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.
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.
What?
Mitigate
ERR_UPLOAD_FILE_CHANGEerrors 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-clientproject, which is used by VideoPress. TheERR_UPLOAD_FILE_CHANGEerror 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_CHANGEerror 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.
Accessibility Testing Instructions
N/A no navigation changes.
Screenshots or screencast
Screen_Recording_20251111_154024_GutenbergKit.mp4