Skip to content

Commit

Permalink
fix(potree2): Fix options request issue with raw.githubusercontent.co…
Browse files Browse the repository at this point in the history
…m data source

fix(potree2): Fix network option
  • Loading branch information
Kevin ETOURNEAU authored and jailln committed Jul 4, 2024
1 parent d5ee112 commit 9abdeed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Core/Potree2Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ class Potree2Node extends PointCloudNode {
const first = byteOffset;
const last = first + byteSize - 1n;

// When we specify 'multipart/byteranges' on headers request it trigger a preflight request
// Actually github doesn't support it https://github.com/orgs/community/discussions/24659
// But if we omit header parameter, github seems to know it's a 'multipart/byteranges' request (thanks to 'Range' parameter)
const networkOptions = {
...this.layer.source.networkOptions,
headers: {
...this.layer.source.networkOptions.headers,
'content-type': 'multipart/byteranges',
...(this.url.startsWith('https://raw.githubusercontent.com') ? {} : { 'content-type': 'multipart/byteranges' }),
Range: `bytes=${first}-${last}`,
},
};
Expand Down

0 comments on commit 9abdeed

Please sign in to comment.