@dropgate/core 3.0.5 → 3.0.6
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/README.md +4 -4
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +17 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2405,6 +2405,15 @@ var DropgateClient = class {
|
|
|
2405
2405
|
}));
|
|
2406
2406
|
} else if (serverMeta.files) {
|
|
2407
2407
|
files = serverMeta.files;
|
|
2408
|
+
if (serverMeta.isEncrypted) {
|
|
2409
|
+
const encryptedChunkSize = this.chunkSize + ENCRYPTION_OVERHEAD_PER_CHUNK;
|
|
2410
|
+
for (const f of files) {
|
|
2411
|
+
if (f.sizeBytes > 0) {
|
|
2412
|
+
const numChunks = Math.ceil(f.sizeBytes / encryptedChunkSize);
|
|
2413
|
+
f.sizeBytes = f.sizeBytes - numChunks * ENCRYPTION_OVERHEAD_PER_CHUNK;
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2408
2417
|
} else {
|
|
2409
2418
|
throw new DropgateProtocolError("Invalid bundle metadata: missing files or manifest.");
|
|
2410
2419
|
}
|
|
@@ -3086,7 +3095,14 @@ var DropgateClient = class {
|
|
|
3086
3095
|
throw new DropgateNetworkError("Could not fetch file metadata.", { cause: err2 });
|
|
3087
3096
|
}
|
|
3088
3097
|
const isEncrypted = Boolean(metadata.isEncrypted);
|
|
3089
|
-
const
|
|
3098
|
+
const encryptedTotalBytes = metadata.sizeBytes || 0;
|
|
3099
|
+
let totalBytes = encryptedTotalBytes;
|
|
3100
|
+
if (isEncrypted && encryptedTotalBytes > 0) {
|
|
3101
|
+
const downloadChunkSize = Number.isFinite(compat.serverInfo?.capabilities?.upload?.chunkSize) && compat.serverInfo.capabilities.upload.chunkSize > 0 ? compat.serverInfo.capabilities.upload.chunkSize : this.chunkSize;
|
|
3102
|
+
const encryptedChunkSize = downloadChunkSize + ENCRYPTION_OVERHEAD_PER_CHUNK;
|
|
3103
|
+
const numChunks = Math.ceil(encryptedTotalBytes / encryptedChunkSize);
|
|
3104
|
+
totalBytes = encryptedTotalBytes - numChunks * ENCRYPTION_OVERHEAD_PER_CHUNK;
|
|
3105
|
+
}
|
|
3090
3106
|
if (!onData && totalBytes > MAX_IN_MEMORY_DOWNLOAD_BYTES) {
|
|
3091
3107
|
const sizeMB = Math.round(totalBytes / (1024 * 1024));
|
|
3092
3108
|
const limitMB = Math.round(MAX_IN_MEMORY_DOWNLOAD_BYTES / (1024 * 1024));
|