Skip to content

Commit 9abdeed

Browse files
Kevin ETOURNEAUjailln
Kevin ETOURNEAU
authored andcommitted
fix(potree2): Fix options request issue with raw.githubusercontent.com data source
fix(potree2): Fix network option
1 parent d5ee112 commit 9abdeed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Core/Potree2Node.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,14 @@ class Potree2Node extends PointCloudNode {
112112
const first = byteOffset;
113113
const last = first + byteSize - 1n;
114114

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

0 commit comments

Comments
 (0)