aboutsummaryrefslogtreecommitdiff
path: root/viewer/src
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src')
-rw-r--r--viewer/src/components/LdDownload.vue10
-rw-r--r--viewer/src/services/navigation.ts7
2 files changed, 10 insertions, 7 deletions
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 @@
30 30
31<script lang="ts"> 31<script lang="ts">
32import { Component, Prop, Vue } from "vue-property-decorator"; 32import { Component, Prop, Vue } from "vue-property-decorator";
33import Navigation from "@/services/navigation";
33 34
34@Component export default class LdDownload extends Vue { 35@Component export default class LdDownload extends Vue {
35 @Prop({ required: true }) readonly item!: Gallery.Other; 36 @Prop({ required: true }) readonly item!: Gallery.Other;
36 37
37 itemResource(): string {
38 return this.item.properties.resource;
39 }
40
41 itemFileName(): string { 38 itemFileName(): string {
42 const timeStamped = this.itemResource().split("/").pop() ?? ""; 39 return Navigation.getFileName(this.item);
43 return timeStamped.split("?")[0];
44 } 40 }
45 41
46 itemDownloadUrl(): string { 42 itemDownloadUrl(): string {
47 return this.$galleryStore.resourceRoot + this.itemResource(); 43 return this.$galleryStore.resourceRoot + this.item.properties.resource;
48 } 44 }
49} 45}
50</script> 46</script>
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}