Skip to content

Commit e88ad99

Browse files
fix(app): drop crossOrigin on map thumbnails to avoid GCS CORS preflight
Setting img.crossOrigin='anonymous' in preloadImages forces a CORS preflight, which fails because the anyplot-images GCS bucket has no CORS headers configured. All 312 thumbnails were getting blocked ("No 'Access-Control-Allow-Origin' header is present"). We only drawImage() these onto the canvas — never call getImageData or toDataURL — so a tainted canvas is fine. Drop the attribute and the browser fetches the images as a regular cross-origin GET that GCS happily serves. Refs #5646 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 004b447 commit e88ad99

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

app/src/pages/MapPage.helpers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ export async function preloadImages(
168168
// document.createElement is preferred over `new Image()` here only because
169169
// some lint configs don't surface browser globals on plain .ts files.
170170
const img = document.createElement('img');
171-
img.crossOrigin = 'anonymous';
171+
// Intentionally NOT setting img.crossOrigin: the GCS bucket has no CORS
172+
// headers, and adding crossOrigin='anonymous' triggers a preflight that
173+
// fails. We only ever drawImage() these onto the canvas (the canvas
174+
// becomes "tainted", which is fine — we never read it back).
172175
img.onload = () => {
173176
out.set(id, img);
174177
onLoad?.(id, img);

0 commit comments

Comments
 (0)