Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix

Manav Rathi8cdbb737dce5
diff --git a/desktop/src/main/services/ffmpeg-worker.ts b/desktop/src/main/services/ffmpeg-worker.ts
index bada29e25f..ed5ad9e144 100644
--- a/desktop/src/main/services/ffmpeg-worker.ts
+++ b/desktop/src/main/services/ffmpeg-worker.ts
@@ -919,7 +919,7 @@ const uploadVideoSegmentsMultipart = async (
partUploadURLs: string[],
completionURL: string,
) => {
- const partSize = Math.floor(videoSize / partUploadURLs.length);
+ const partSize = Math.ceil(videoSize / partUploadURLs.length);
let partNumber = 0;
let nextStart = 0;
// See `createMultipartUploadRequestBody` in the web code for a more
@@ -941,7 +941,7 @@ const uploadVideoSegmentsMultipart = async (
body: Readable.toWeb(
fs_.createReadStream(videoFilePath, {
start: nextStart,
- end: size - 1,
+ end: nextStart + size - 1,
}),
),
}),
diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.ts
index 222f7333ef..3cbd332265 100644
--- a/desktop/src/main/stream.ts
+++ b/desktop/src/main/stream.ts
@@ -291,7 +291,7 @@ const handleGenerateHLSWrite = async (
params: URLSearchParams,
) => {
const uploadURLs = params.getAll("url");
- if (uploadURLs.length) throw new Error("Missing upload URL(s)");
+ if (!uploadURLs.length) throw new Error("Missing upload URL(s)");
let inputItem: Parameters<typeof makeFileForStreamOrPathOrZipItem>[0];
const path = params.get("path");
diff --git a/web/packages/gallery/services/file-data.ts b/web/packages/gallery/services/file-data.ts
index b4e95a3a31..ecc5246456 100644
--- a/web/packages/gallery/services/file-data.ts
+++ b/web/packages/gallery/services/file-data.ts
@@ -445,7 +445,7 @@ export const getFilePreviewDataUploadURL = async (file: EnteFile) => {
//
// The eventual part size will then be:
//
- // partSize = (totalSize, count) => Math.floor(totalSize / count)
+ // partSize = (totalSize, count) => Math.ceil(totalSize / count)
//
// As an example, for a 200 MB file, we'll estimate partCount of 2, and
// suppose the generated file is 50% of the original, then each part size
@@ -454,10 +454,13 @@ export const getFilePreviewDataUploadURL = async (file: EnteFile) => {
// As a sanity check of the other extreme, if the generated file is 10% of
// the original, we still end up with 10 MB parts.
let partCount = 1; // Default is single object upload.
- const fileSize = file.info?.fileSize;
- if (fileSize && fileSize > 100 * 1024 /* 100 MB */) {
- // For files larger than 100 MB, estimate the number of 100 MB parts.
- partCount = Math.ceil((0.7 * fileSize) / (100 * 1024));
+ const fileSize = file.info?.fileSize; /* bytes */
+ if (fileSize) {
+ const fileSizeMB = fileSize / 1024 / 1024;
+ // For files larger than 100 MB, estimate the number of ~100 MB parts.
+ if (fileSizeMB > 100) {
+ partCount = Math.ceil((0.7 * fileSize) / (100 * 1024));
+ }
}
const params = new URLSearchParams({