fix: Fetch uncached assets from remote server #301
+160
−24
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?
Prevents crashes when the editor requests assets that aren't in the local cache and adds a fallback to fetch them from the original server.
Why?
Inserting certain plugin blocks (e.g., the Writing Prompt block) causes a crash because:
url(/icon.svg)gbk-cache-httpsscheme.js/.cssfiles are cached)assetDataPath(for:)method's precondition fails when the path escapes the bundle root, causing a crashFix CMM-1176. Fix JETPACK-IOS-1JFR.
How?
Two changes:
Added
isValidAssetPath(for:)- A safe method to check if a URL resolves to a valid path within the bundle root, without triggering the precondition crashAdded remote fetching fallback - When an asset isn't in the local cache (invalid path or missing file), the provider now fetches it from the original HTTPS URL and serves it to the WebView
Testing Instructions
Accessibility Testing Instructions
N/A - No UI changes
Screenshots or screencast
N/A
Footnotes
I was unable to reproduce the crash locally, only in the TestFlight build. ↩