From c98d5a3e4069026d2803a181d7fc3afbeeb58f79 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Tue, 16 Apr 2024 20:59:27 +0530 Subject: [PATCH] Filter out files with HEIC previews --- web/apps/cast/src/pages/slideshow.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/web/apps/cast/src/pages/slideshow.tsx b/web/apps/cast/src/pages/slideshow.tsx index 3a98efbf5e..774bbd4da9 100644 --- a/web/apps/cast/src/pages/slideshow.tsx +++ b/web/apps/cast/src/pages/slideshow.tsx @@ -20,7 +20,7 @@ export default function Slideshow() { const [castToken, setCastToken] = useState(""); const [castCollection, setCastCollection] = useState< Collection | undefined - >(undefined); + >(); const [collectionFiles, setCollectionFiles] = useState([]); const [currentFileId, setCurrentFileId] = useState(); const [currentFileURL, setCurrentFileURL] = useState(); @@ -67,23 +67,12 @@ export default function Slideshow() { const isFileEligibleForCast = (file: EnteFile) => { const fileType = file.metadata.fileType; - if (fileType !== FILE_TYPE.IMAGE && fileType !== FILE_TYPE.LIVE_PHOTO) { + if (fileType !== FILE_TYPE.IMAGE && fileType !== FILE_TYPE.LIVE_PHOTO) return false; - } - const fileSizeLimit = 100 * 1024 * 1024; + if (file.info.fileSize > 100 * 1024 * 1024) return false; - if (file.info.fileSize > fileSizeLimit) { - return false; - } - - const name = file.metadata.title; - - if (fileType === FILE_TYPE.IMAGE) { - if (isRawFileFromFileName(name)) { - return false; - } - } + if (isRawFileFromFileName(file.metadata.title)) return false; return true; };