@knime/utils 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/uploadManager/index.ts +5 -8
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -28,6 +28,7 @@ const uploadChunkWithProgress = (params: {
|
|
|
28
28
|
const { method, url, chunk, chunkIndex, onProgress, abortSignal } = params;
|
|
29
29
|
|
|
30
30
|
const OK = 200;
|
|
31
|
+
const CREATED = 201;
|
|
31
32
|
|
|
32
33
|
return new Promise<{ partId: string }>((resolve, reject) => {
|
|
33
34
|
const xhr = new XMLHttpRequest();
|
|
@@ -44,17 +45,13 @@ const uploadChunkWithProgress = (params: {
|
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
xhr.onload = () => {
|
|
47
|
-
if (xhr.status === OK) {
|
|
48
|
+
if (xhr.status === OK || xhr.status === CREATED) {
|
|
48
49
|
const etag = xhr.getResponseHeader("ETag");
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// remove possible doublequotes (") around the etag and/or weak identifier (if either is present)
|
|
51
|
+
// 1. note that some backends don't return the etag header, then we just set an empty string
|
|
52
|
+
// 2. remove possible doublequotes (") around the etag and/or weak identifier (if either is present)
|
|
56
53
|
// https://datatracker.ietf.org/doc/html/rfc7232#section-2.3
|
|
57
|
-
resolve({ partId: etag
|
|
54
|
+
resolve({ partId: etag?.replace(/^(?:W\/)?"|"$/g, "") ?? "" });
|
|
58
55
|
} else {
|
|
59
56
|
consola.error("Failed or unexpected XHR response", {
|
|
60
57
|
xhrStatus: xhr.status,
|