Skip to content

armgit / ente

Public Imported from GitHub
0

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

Cleanup

Manav Rathi912d52ea6b30
diff --git a/desktop/src/main/stream.ts b/desktop/src/main/stream.ts
index d55c5002c3..db9de8ff4e 100644
--- a/desktop/src/main/stream.ts
+++ b/desktop/src/main/stream.ts
@@ -300,20 +300,23 @@ const handleGenerateHLSWrite = async (
outputFilePathPrefix,
);
- const videoFilePath = result.videoPath;
+ const { playlistPath, videoPath } = result;
try {
- await uploadVideoSegments(videoFilePath, objectUploadURL);
+ await uploadVideoSegments(videoPath, objectUploadURL);
const playlistToken = randomUUID();
- pendingVideoResults.set(playlistToken, result.playlistPath);
+ pendingVideoResults.set(playlistToken, playlistPath);
const { dimensions, videoSize } = result;
return new Response(
JSON.stringify({ playlistToken, dimensions, videoSize }),
{ status: 200 },
);
+ } catch (e) {
+ await deleteTempFileIgnoringErrors(playlistPath);
+ throw e;
} finally {
- await deleteTempFileIgnoringErrors(videoFilePath);
+ await deleteTempFileIgnoringErrors(videoPath);
}
} finally {
await deleteTempFileIgnoringErrors(inputTempFilePath);
diff --git a/web/packages/gallery/utils/native-stream.ts b/web/packages/gallery/utils/native-stream.ts
index 59a7ac997a..9f15ce6b35 100644
--- a/web/packages/gallery/utils/native-stream.ts
+++ b/web/packages/gallery/utils/native-stream.ts
@@ -179,17 +179,17 @@ export const writeVideoStream = async (
queryParams?: URLSearchParams,
): Promise<Response> => {
let url = `stream://video?op=${op}`;
- if (queryParams) {
- url += `&${queryParams.toString()}`;
- }
+ if (queryParams) url += `&${queryParams.toString()}`;
const req = new Request(url, {
method: "POST",
- body: video,
+ // The duplex option is required when body is a stream.
+ //
// @ts-expect-error TypeScript's libdom.d.ts does not include the
// "duplex" parameter, e.g. see
// https://github.com/node-fetch/node-fetch/issues/1769.
duplex: "half",
+ body: video,
});
const res = await fetch(req);