From a2e06f0a217b12d92cecdad77c20de88037f9912 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 19 May 2020 21:05:28 +0200 Subject: viewer/navigation: factorise item file name extraction --- viewer/src/services/navigation.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'viewer/src/services') 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 { return "file"; } } + + // Get the file name of an item, without its cache timestamp + public static getFileName(item: Gallery.Item): string { + if (item.properties.type === "directory") return item.title; + const timeStamped = item.properties.resource.split("/").pop() ?? ""; + return timeStamped.split("?")[0]; + } } -- cgit v1.2.3