aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/services
diff options
context:
space:
mode:
authorpacien2020-05-19 21:05:28 +0200
committerNotkea2020-05-22 01:02:18 +0200
commita2e06f0a217b12d92cecdad77c20de88037f9912 (patch)
tree1c74a7e0532f4169be60556c5b6f16b74c620d5a /viewer/src/services
parent037db071d42d4a7fdb8ed5cf88bc2c37fba4ae93 (diff)
downloadldgallery-a2e06f0a217b12d92cecdad77c20de88037f9912.tar.gz
viewer/navigation: factorise item file name extraction
Diffstat (limited to 'viewer/src/services')
-rw-r--r--viewer/src/services/navigation.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/viewer/src/services/navigation.ts b/viewer/src/services/navigation.ts
index 7d1ae50..f96904d 100644
--- a/viewer/src/services/navigation.ts
+++ b/viewer/src/services/navigation.ts
@@ -81,4 +81,11 @@ export default class Navigation {
81 return "file"; 81 return "file";
82 } 82 }
83 } 83 }
84
85 // Get the file name of an item, without its cache timestamp
86 public static getFileName(item: Gallery.Item): string {
87 if (item.properties.type === "directory") return item.title;
88 const timeStamped = item.properties.resource.split("/").pop() ?? "";
89 return timeStamped.split("?")[0];
90 }
84} 91}