Check file headers instead of filename regex to determine image format
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
This came up in https://github.com/CesiumGS/cesium/pull/9513 - files like `Material.js` have code along the lines of:
```js
var ktx2Regex = /\.ktx2$/i;
function createTexture2DUpdateFunction(uniformId) {
...
if (ktx2Regex.test(resource.url)) {
promise = loadKTX2(resource.url);
} else {
promise = resource.fetchImage();
}
...
}
```
We should update these checks to check .ktx2 header info since not all files will have the .ktx2 extension.
Contributor guide
Research direction
Start with the filename-based KTX2 check shown in Material.js, then trace how loadKTX2 and resource.fetchImage are selected. Done means the relevant image-format checks use KTX2 header information so files without a .ktx2 extension still use the correct loader.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100