@axium/storage 0.23.0 → 0.23.2
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/dist/client/api.js
CHANGED
|
@@ -52,6 +52,7 @@ async function _upload(upload, stream, itemSize, onProgress) {
|
|
|
52
52
|
const headers = {
|
|
53
53
|
'x-upload': upload.token,
|
|
54
54
|
'x-offset': offset.toString(),
|
|
55
|
+
'x-chunk-size': chunkSize.toString(),
|
|
55
56
|
'content-length': chunkSize.toString(),
|
|
56
57
|
'content-type': 'application/octet-stream',
|
|
57
58
|
};
|
package/dist/server/raw.js
CHANGED
|
@@ -49,9 +49,9 @@ addRoute({
|
|
|
49
49
|
if (!getConfig('@axium/storage').enabled)
|
|
50
50
|
error(503, 'User storage is disabled');
|
|
51
51
|
const upload = await requireUpload(request);
|
|
52
|
-
const size = BigInt(request.headers.get('
|
|
52
|
+
const size = BigInt(request.headers.get('x-chunk-size') || -1);
|
|
53
53
|
if (size < 0n)
|
|
54
|
-
error(411, 'Missing or invalid
|
|
54
|
+
error(411, 'Missing or invalid chunk size');
|
|
55
55
|
if (upload.uploadedBytes + size > upload.init.size)
|
|
56
56
|
error(413, 'Upload exceeds allowed size');
|
|
57
57
|
const offset = BigInt(request.headers.get('x-offset') || -1);
|
package/package.json
CHANGED
|
@@ -27,11 +27,13 @@
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function useAndClearActive(thunk: () => any) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
return () => {
|
|
31
|
+
if (!activeItem) throw text('storage.generic.no_item');
|
|
32
|
+
const result = thunk();
|
|
33
|
+
const index = items.findIndex(item => item.id === activeId);
|
|
34
|
+
if (index !== -1) items.splice(index, 1);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
35
37
|
}
|
|
36
38
|
</script>
|
|
37
39
|
|