use file extension
even if there is no file extension no extra will be added (like a period .) because {{.FileExtension}} includes the "."
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ if (link && navigator.clipboard?.writeText) {
|
||||
link.onclick = async (e) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
await navigator.clipboard.writeText(`${location.origin}/${link.dataset.id}`);
|
||||
await navigator.clipboard.writeText(`${location.origin}/${link.dataset.id}${link.dataset.extension}`);
|
||||
link.textContent = "copied";
|
||||
setTimeout(() => {
|
||||
link.textContent = "copy link";
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
<main>
|
||||
<div>
|
||||
{{if hasPrefix .MIMEType "image/"}}
|
||||
<img src="/{{.ID}}" />
|
||||
<img src="/{{.ID}}{{.FileExtension}}" />
|
||||
{{else if hasPrefix .MIMEType "video/"}}
|
||||
<video src="/{{.ID}}" controls></video>
|
||||
<video src="/{{.ID}}{{.FileExtension}}" controls></video>
|
||||
{{else if hasPrefix .MIMEType "audio/"}}
|
||||
<audio src="/{{.ID}}" controls></audio>
|
||||
<audio src="/{{.ID}}{{.FileExtension}}" controls></audio>
|
||||
{{else}}
|
||||
<h2>{{.Filename}}</h2>
|
||||
<h2>{{.ID}}{{.FileExtension}}</h2>
|
||||
@@ -87,7 +87,7 @@
|
||||
copying is only available with javascript
|
||||
we will make this element visible with javascript
|
||||
-->
|
||||
<a id="copy-link" data-id="{{.ID}}" href="#" style="display: none">copy link</a>
|
||||
<a id="copy-link" data-id="{{.ID}}" data-extension="{{.FileExtension}}" href="#" style="display: none">copy link</a>
|
||||
<form action="/{{.ID}}/delete?redirect=true" method="post">
|
||||
<input type="hidden" name="delete_token" value="{{.DeleteToken}}" />
|
||||
<button type="submit" class="link-btn">delete upload</button>
|
||||
|
||||
Reference in New Issue
Block a user