π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
rename functions
Abhinav3f7030c9b41b
diff --git a/apps/photos/src/services/livePhotoService.ts b/apps/photos/src/services/livePhotoService.tsindex bffdd83200..613d2861ec 100644--- a/apps/photos/src/services/livePhotoService.ts+++ b/apps/photos/src/services/livePhotoService.ts@@ -1,6 +1,9 @@import JSZip from 'jszip';import { EnteFile } from 'types/file';-import { fileExtensionWithDot, fileNameWithoutExtension } from 'utils/file';+import {+ getFileExtensionWithDot,+ getFileNameWithoutExtension,+} from 'utils/file';class LivePhoto {image: Uint8Array;@@ -10,18 +13,18 @@ class LivePhoto {}export const decodeLivePhoto = async (file: EnteFile, zipBlob: Blob) => {- const originalName = fileNameWithoutExtension(file.metadata.title);+ const originalName = getFileNameWithoutExtension(file.metadata.title);const zip = await JSZip.loadAsync(zipBlob, { createFolders: true });const livePhoto = new LivePhoto();for (const zipFilename in zip.files) {if (zipFilename.startsWith('image')) {livePhoto.imageNameTitle =- originalName + fileExtensionWithDot(zipFilename);+ originalName + getFileExtensionWithDot(zipFilename);livePhoto.image = await zip.files[zipFilename].async('uint8array');} else if (zipFilename.startsWith('video')) {livePhoto.videoNameTitle =- originalName + fileExtensionWithDot(zipFilename);+ originalName + getFileExtensionWithDot(zipFilename);livePhoto.video = await zip.files[zipFilename].async('uint8array');}}@@ -31,11 +34,11 @@ export const decodeLivePhoto = async (file: EnteFile, zipBlob: Blob) => {export const encodeLivePhoto = async (livePhoto: LivePhoto) => {const zip = new JSZip();zip.file(- 'image' + fileExtensionWithDot(livePhoto.imageNameTitle),+ 'image' + getFileExtensionWithDot(livePhoto.imageNameTitle),livePhoto.image);zip.file(- 'video' + fileExtensionWithDot(livePhoto.videoNameTitle),+ 'video' + getFileExtensionWithDot(livePhoto.videoNameTitle),livePhoto.video);return await zip.generateAsync({ type: 'uint8array' });diff --git a/apps/photos/src/utils/file/index.ts b/apps/photos/src/utils/file/index.tsindex f5f324d01b..bb4cf2dedc 100644--- a/apps/photos/src/utils/file/index.ts+++ b/apps/photos/src/utils/file/index.ts@@ -292,13 +292,13 @@ export async function decryptFile(}}-export function fileNameWithoutExtension(filename: string) {+export function getFileNameWithoutExtension(filename: string) {const lastDotPosition = filename.lastIndexOf('.');if (lastDotPosition === -1) return filename;else return filename.slice(0, lastDotPosition);}-export function fileExtensionWithDot(filename: string) {+export function getFileExtensionWithDot(filename: string) {const lastDotPosition = filename.lastIndexOf('.');if (lastDotPosition === -1) return '';else return filename.slice(lastDotPosition);