Visitar URL original
fix(ios): honor cacheType and headers in ImagePipeline prefetch by aleclarson · Pull Request #69 · nativescript-community/ui-image · GitHub
Skip to content

fix(ios): honor cacheType and headers in ImagePipeline prefetch - #69

Merged
farfromrefug merged 1 commit into
nativescript-community:masterfrom
aleclarson:fix/ios-prefetch-cachetype-headers
Oct 8, 2026
Merged

farfromrefug merged 1 commit into
nativescript-community:masterfrom
aleclarson:fix/ios-prefetch-cachetype-headers

Conversation

@aleclarson

Copy link
Copy Markdown
Contributor

Problem

Two iOS prefetch regressions vs. the 4.x line:

  1. prefetchToCacheType ignores its cacheType argument. SDWebImagePrefetcher's default context stores to disk+memory either way, so a disk prefetch also decodes and warms memory — diverging from Android's bytes-only Glide.downloadOnly behavior.
  2. getContextFromOptions drops PrefetchOptions.headers because it never sets SDWebImageContextDownloadRequestModifier, so prefetch({ headers }) silently sends no headers on iOS while Android's CustomGlideUrl forwards them.

Fix

Ports the 4.x implementation forward:

  • prefetchToCacheType sets SDWebImageContextStoreCacheType on the prefetch context, plus SDWebImageContextOriginalStoreCacheType so a memory prefetch does not spill original bytes to disk.
  • getContextFromOptions applies options.headers through an SDWebImageDownloaderRequestModifier — same pattern as the existing Img.headers handling in updateView, which also fixes headers for getCacheKey and the other prefetch callers.

Upstream-relevant note: 4.x additionally allowed headers as a () => Record<string, string> thunk; 5.x types it Record<string, string> only, so this uses the plain form.

prefetchToCacheType ignored its cacheType argument: SDWebImagePrefetcher's
default context stores to disk+memory either way, so a disk prefetch also
decoded and warmed memory — diverging from Android's bytes-only Glide
downloadOnly. And getContextFromOptions dropped PrefetchOptions.headers
because it never set SDWebImageContextDownloadRequestModifier, so
prefetch({ headers }) silently sent no headers on iOS while Android's
CustomGlideUrl forwarded them.

This restores the 4.x behavior: set SDWebImageContextStoreCacheType on the
prefetch context and apply options.headers through a request modifier in
getContextFromOptions (which also fixes headers for getCacheKey and the
other prefetch callers). Additionally sets
SDWebImageContextOriginalStoreCacheType so a memory prefetch does not
spill original bytes to disk.
aleclarson added a commit to octane-xplat/octane-xplat that referenced this pull request Oct 8, 2026
Filed upstream PRs for the five patch-audit fixes and recorded them via a
new upstreamPR field on the manifest entries:

- nativescript-community/octane#14 — setProp undefined-skip, visibility
  capability, intrinsic ref types
- nativescript-community/octane#15 — vite-octane .tsrx HMR matching and
  recipients counting
- nativescript-community/ui-image#69 — iOS prefetch cacheType + headers
- nfrasser/linkifyjs#572 — ICU-free \p{} regex construction
- facebook/lexical#9334 — @lexical/link URL_REGEX via new RegExp
- NativeScript/NativeScript#11514 — font-weight → wght axis mapping on
  Android (issue #11513)
@farfromrefug
farfromrefug merged commit eae1844 into nativescript-community:master Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants