xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
728 stars 288 forks source link

Uncaught incorrect header check #762

Closed fabripetrelli closed 3 years ago

fabripetrelli commented 3 years ago

Hi everyone, I'm trying to fetch an XKT from an API

The API returns the XKT in base64 so the steps to reproduce are:

const data = atob(fileXKT);
const test = new Blob([data], { type: 'application/*; charset=utf-8' });
const url = URL.createObjectURL(test);

model = xktloader.load({
  src: url,
});

Initially the components render the loading circle and then it stops leaving a blank component and an error in the console: Uncaught incorrect header check

How to fix?

xeolabs commented 3 years ago

This is not a bug, so no fix to xeokit required for this. The src parameter for the XKTLoaderPlugin#load call is assumed to be a path to a file, not the Base64-encoded contents of the file.

https://xeokit.github.io/xeokit-sdk/docs/class/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js~XKTLoaderPlugin.html#instance-method-load

fabripetrelli commented 3 years ago

The error persist even if we pass it to the xkt parameter as an arrayBuffer, how we can fix this?

xeolabs commented 3 years ago

The xkt parameter works OK for us so far, so it is difficult to guess what is wrong with your ArrayBuffer without the means to reproduce the error - could you please post a working example that reproduces the error.