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/components/LdDownload.vue | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

(limited to 'viewer/src/components/LdDownload.vue')

diff --git a/viewer/src/components/LdDownload.vue b/viewer/src/components/LdDownload.vue
index aea4123..d7dfb7d 100644
--- a/viewer/src/components/LdDownload.vue
+++ b/viewer/src/components/LdDownload.vue
@@ -30,21 +30,17 @@
 
 <script lang="ts">
 import { Component, Prop, Vue } from "vue-property-decorator";
+import Navigation from "@/services/navigation";
 
 @Component export default class LdDownload extends Vue {
   @Prop({ required: true }) readonly item!: Gallery.Other;
 
-  itemResource(): string {
-    return this.item.properties.resource;
-  }
-
   itemFileName(): string {
-    const timeStamped = this.itemResource().split("/").pop() ?? "";
-    return timeStamped.split("?")[0];
+    return Navigation.getFileName(this.item);
   }
 
   itemDownloadUrl(): string {
-    return this.$galleryStore.resourceRoot + this.itemResource();
+    return this.$galleryStore.resourceRoot + this.item.properties.resource;
   }
 }
 </script>
-- 
cgit v1.2.3

