Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use nid

Manav Rathie17bc10d6776
diff --git a/web/packages/new/photos/services/ffmpeg/web.ts b/web/packages/new/photos/services/ffmpeg/web.ts
index 1c206a4c26..cec054a78c 100644
--- a/web/packages/new/photos/services/ffmpeg/web.ts
+++ b/web/packages/new/photos/services/ffmpeg/web.ts
@@ -1,3 +1,4 @@
+import { newID } from "@/base/id";
import log from "@/base/log";
import { FFmpeg } from "@ffmpeg/ffmpeg";
import {
@@ -54,9 +55,9 @@ const ffmpegExec = async (
outputFileExtension: string,
blob: Blob,
) => {
- const inputPath = randomPrefix();
+ const inputPath = newID("in_");
const outputSuffix = outputFileExtension ? "." + outputFileExtension : "";
- const outputPath = randomPrefix() + outputSuffix;
+ const outputPath = newID("out_") + outputSuffix;
const cmd = substitutePlaceholders(command, inputPath, outputPath);
@@ -88,17 +89,6 @@ const ffmpegExec = async (
}
};
-/** Generate a random string suitable for being used as a file name prefix */
-const randomPrefix = () => {
- const alphabet =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
- let result = "";
- for (let i = 0; i < 10; i++)
- result += alphabet[Math.floor(Math.random() * alphabet.length)]!;
- return result;
-};
-
const substitutePlaceholders = (
command: string[],
inputFilePath: string,