Dedup
This commit is contained in:
parent
871cb417d6
commit
fb1d2c800a
3 changed files with 26 additions and 31 deletions
|
@ -85,18 +85,6 @@ export async function decryptFile(
|
|||
}
|
||||
}
|
||||
|
||||
export function getFileNameWithoutExtension(filename: string) {
|
||||
const lastDotPosition = filename.lastIndexOf(".");
|
||||
if (lastDotPosition === -1) return filename;
|
||||
else return filename.slice(0, lastDotPosition);
|
||||
}
|
||||
|
||||
export function getFileExtensionWithDot(filename: string) {
|
||||
const lastDotPosition = filename.lastIndexOf(".");
|
||||
if (lastDotPosition === -1) return "";
|
||||
else return filename.slice(lastDotPosition);
|
||||
}
|
||||
|
||||
export function generateStreamFromArrayBuffer(data: Uint8Array) {
|
||||
return new ReadableStream({
|
||||
async start(controller: ReadableStreamDefaultController) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { encodeLivePhoto } from "@/media/live-photo";
|
||||
import log from "@/next/log";
|
||||
import { DedicatedCryptoWorker } from "@ente/shared/crypto/internal/crypto.worker";
|
||||
import { CustomError } from "@ente/shared/error";
|
||||
import { Remote } from "comlink";
|
||||
import { FILE_TYPE } from "constants/file";
|
||||
import { LIVE_PHOTO_ASSET_SIZE_LIMIT } from "constants/upload";
|
||||
import { encodeLivePhoto } from "@/media/live-photo";
|
||||
import { getFileType } from "services/typeDetectionService";
|
||||
import {
|
||||
ElectronFile,
|
||||
|
@ -14,12 +14,6 @@ import {
|
|||
LivePhotoAssets,
|
||||
ParsedMetadataJSONMap,
|
||||
} from "types/upload";
|
||||
import {
|
||||
getFileExtensionWithDot,
|
||||
getFileNameWithoutExtension,
|
||||
isImageOrVideo,
|
||||
splitFilenameAndExtension,
|
||||
} from "utils/file";
|
||||
import { getFileTypeFromExtensionForLivePhotoClustering } from "utils/file/livePhoto";
|
||||
import { getUint8ArrayView } from "../readerService";
|
||||
import { extractFileMetadata } from "./fileService";
|
||||
|
@ -304,3 +298,28 @@ function removePotentialLivePhotoSuffix(
|
|||
return filenameWithoutExtension;
|
||||
}
|
||||
}
|
||||
|
||||
function getFileNameWithoutExtension(filename: string) {
|
||||
const lastDotPosition = filename.lastIndexOf(".");
|
||||
if (lastDotPosition === -1) return filename;
|
||||
else return filename.slice(0, lastDotPosition);
|
||||
}
|
||||
|
||||
function getFileExtensionWithDot(filename: string) {
|
||||
const lastDotPosition = filename.lastIndexOf(".");
|
||||
if (lastDotPosition === -1) return "";
|
||||
else return filename.slice(lastDotPosition);
|
||||
}
|
||||
|
||||
function splitFilenameAndExtension(filename: string): [string, string] {
|
||||
const lastDotPosition = filename.lastIndexOf(".");
|
||||
if (lastDotPosition === -1) return [filename, null];
|
||||
else
|
||||
return [
|
||||
filename.slice(0, lastDotPosition),
|
||||
filename.slice(lastDotPosition + 1),
|
||||
];
|
||||
}
|
||||
|
||||
const isImageOrVideo = (fileType: FILE_TYPE) =>
|
||||
[FILE_TYPE.IMAGE, FILE_TYPE.VIDEO].includes(fileType);
|
||||
|
|
|
@ -250,18 +250,6 @@ export async function decryptFile(
|
|||
}
|
||||
}
|
||||
|
||||
export function getFileNameWithoutExtension(filename: string) {
|
||||
const lastDotPosition = filename.lastIndexOf(".");
|
||||
if (lastDotPosition === -1) return filename;
|
||||
else return filename.slice(0, lastDotPosition);
|
||||
}
|
||||
|
||||
export function getFileExtensionWithDot(filename: string) {
|
||||
const lastDotPosition = filename.lastIndexOf(".");
|
||||
if (lastDotPosition === -1) return "";
|
||||
else return filename.slice(lastDotPosition);
|
||||
}
|
||||
|
||||
export function splitFilenameAndExtension(filename: string): [string, string] {
|
||||
const lastDotPosition = filename.lastIndexOf(".");
|
||||
if (lastDotPosition === -1) return [filename, null];
|
||||
|
|
Loading…
Reference in a new issue