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) => {
|
link.onclick = async (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
try {
|
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";
|
link.textContent = "copied";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
link.textContent = "copy link";
|
link.textContent = "copy link";
|
||||||
|
|||||||
@@ -12,11 +12,11 @@
|
|||||||
<main>
|
<main>
|
||||||
<div>
|
<div>
|
||||||
{{if hasPrefix .MIMEType "image/"}}
|
{{if hasPrefix .MIMEType "image/"}}
|
||||||
<img src="/{{.ID}}" />
|
<img src="/{{.ID}}{{.FileExtension}}" />
|
||||||
{{else if hasPrefix .MIMEType "video/"}}
|
{{else if hasPrefix .MIMEType "video/"}}
|
||||||
<video src="/{{.ID}}" controls></video>
|
<video src="/{{.ID}}{{.FileExtension}}" controls></video>
|
||||||
{{else if hasPrefix .MIMEType "audio/"}}
|
{{else if hasPrefix .MIMEType "audio/"}}
|
||||||
<audio src="/{{.ID}}" controls></audio>
|
<audio src="/{{.ID}}{{.FileExtension}}" controls></audio>
|
||||||
{{else}}
|
{{else}}
|
||||||
<h2>{{.Filename}}</h2>
|
<h2>{{.Filename}}</h2>
|
||||||
<h2>{{.ID}}{{.FileExtension}}</h2>
|
<h2>{{.ID}}{{.FileExtension}}</h2>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
copying is only available with javascript
|
copying is only available with javascript
|
||||||
we will make this element visible 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">
|
<form action="/{{.ID}}/delete?redirect=true" method="post">
|
||||||
<input type="hidden" name="delete_token" value="{{.DeleteToken}}" />
|
<input type="hidden" name="delete_token" value="{{.DeleteToken}}" />
|
||||||
<button type="submit" class="link-btn">delete upload</button>
|
<button type="submit" class="link-btn">delete upload</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user