CesiumGS / CesiumGS/cesium

FetchImage with ImageBitmap doesn't handle internal redirect

Open
#7,735 1 comment 0 reactions 0 assignees View on GitHub
category - graphics type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

[Forum thread](https://groups.google.com/d/msg/cesium-dev/Sh88x-cdsxA/ck74f_EFCAAJ)

[This Sandcastle](https://www.google.com/url?q=https%3A%2F%2Fcesiumjs.org%2FCesium%2FBuild%2FApps%2FSandcastle%2F%23c%3DbVLLbtswEPyVhS%2ByAYOMc2odxyjgFkFQGwmqPA5VDmtpLbMlRYGkFLtB%2F71LK0LtJDqJuzOc5cy26KBV9EwOLqGiZ1iQV40RD4faMMkPx4WtAqqKXDK6yCop4dsOTa0JJgLu06sU%2FBYLKsCRVrSBoDR5GH5%2FuB1lVcsKXfvHoTs5FXqk9QrrO2ak5FqV07XBktz%2B1tlWFTzCS1YBf43TMIVkG0I9lXKNngzWosKgbIU6%2Fpe2lejyUnnpyAfpu%2Fu8jBOmRxPcVHovWTQKkpOPq7s0GXcqGvfsBOt8xOlBPuz56QwqaIONDn19Y53BEBsqvkH%2Bqqnse9GSFQandimF669H7LPzT8b0MLb2P3KJa9KeoT9PsNOzZHzKnk7eVc4TEEI8vV5rcKdMY5bUkp7C5PNrOXdUqDjwUR6LQ22Y3AtIBVyR1bZUOWpIG3Zrn3Cif%2BMSdEsjVJfWMvrmBRbF2%2FhOoh9dDMaD2cG%2FeTfCF2Vq60KMdyiEDMRrhYFDWzf5bwoi9z6qzWRPmhWqBVVcZoM3q5kNINfoPXc2jdap%2BkPZYD6TjD%2BhaYuFqsobjp7TjpDtZL7simzZTPLxPStYq9fojm78Bw&sa=D&sntz=1&usg=AFQjCNGzwbwqyK8o44m7M6CcWhd_GUn-ug) tries to load imagery via `http`.

The browser will block the mixed content requests, so imagery does not load. However, turning off imagebitmap support by adding:

```
Cesium.Resource.supportsImageBitmapOptions = function(){
return Cesium.when.resolve(false);
};
```

Shows that the imagery first receives a `307 Internal Redirect`, and then redirects to the https URL, which works fine.

I think this is because when we `fetchImage` with `preferImageBitmap`, we will always try to fetch the image as a blob, since that allows the decode to happen off the main thread. So this `fetchBlob` code-path doesn't handle the redirect?

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the linked Sandcastle, then trace fetchImage with preferImageBitmap into the fetchBlob path and inspect supportsImageBitmapOptions. Confirm the fix allows the 307 internal redirect to reach the HTTPS image URL while retaining ImageBitmap support, and verify that imagery loads without disabling the option.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.