Skip to content

armgit / ente

Public Imported from GitHub
0

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

Compose

Manav Rathi9d4a76a6424e
diff --git a/web/apps/photos/src/services/watch.ts b/web/apps/photos/src/services/watch.ts
index 3c9f79eeaa..51d9484e6f 100644
--- a/web/apps/photos/src/services/watch.ts
+++ b/web/apps/photos/src/services/watch.ts
@@ -4,6 +4,7 @@
*/
import { ensureElectron } from "@/next/electron";
+import { basename, dirname } from "@/next/file";
import log from "@/next/log";
import type {
CollectionMapping,
@@ -751,12 +752,4 @@ const collectionNameForPath = (filePath: string, watch: FolderWatch) =>
? watch.rootFolderName
: parentDirectoryName(filePath);
-const parentDirectoryName = (filePath: string) => {
- const components = filePath.split("/");
- const parentName = components[components.length - 2];
- if (!parentName)
- throw new Error(
- `Unexpected file path without a parent folder: ${filePath}`,
- );
- return parentName;
-};
+const parentDirectoryName = (path: string) => basename(dirname(path));