remove file download api

This commit is contained in:
2018-11-06 22:19:57 +01:00
parent 7f2d549368
commit 534c456a5b
4 changed files with 18 additions and 21 deletions

View File

@@ -36,7 +36,7 @@ var Toolbar = {
}
},
download: function () {
$("#frmDownload").attr("src", "/api/file/" + Viewer.currentFile + "/download");
$("#frmDownload").attr("src", "/api/file/" + Viewer.currentFile + "?download");
},
downloadList: function(){
if(!Viewer.isList){

View File

@@ -70,7 +70,6 @@
<h2>File Methods</h2>
{{template "api-file-post"}}
{{template "api-file-id-get"}}
{{template "api-file-id-download-get"}}
{{template "api-file-id-info-get"}}
{{template "api-file-id-thumbnail-get"}}
{{template "api-file-id-delete"}}

View File

@@ -80,6 +80,11 @@
Returns the full file associated with the ID. Supports
byte range requests.
</p>
<p>
When '?download' is added to the URL the server will send an
attachment header instead of inline rendering, which causes the
browser to show a 'Save File' dialog.
</p>
<h3>Parameters</h3>
<table>
<tr>
@@ -94,25 +99,18 @@
<td>URL</td>
<td>ID of the file to request</td>
</tr>
<tr>
<td>download</td>
<td>false</td>
<td>URL</td>
<td>Sends file attachment instead of inline</td>
</tr>
</table>
<h3>Returns</h3>
A file output stream.
</div>
</details>
{{end}}
{{define "api-file-id-download-get"}}
<details class="api_doc_details request_get">
<summary><span class="method">GET</span>/file/{id}/download</summary>
<div>
<h3>Description</h3>
<p>
Same as GET /file/{id}, but with File Transfer HTTP
headers. Will trigger a save file dialog when opened in
a web browser. Also supports byte range requests.
</p>
</div>
</details>
{{end}}
{{define "api-file-id-info-get"}}
<details class="api_doc_details request_get">
<summary><span class="method">GET</span>/file/{id}/info</summary>

View File

@@ -49,7 +49,7 @@ type filePreview struct {
func (f filePreview) run(inf *pixelapi.FileInfo) string {
f.FileInfo = inf
f.FileURL = f.APIURL + "/file/" + f.FileInfo.ID
f.DownloadURL = f.APIURL + "/file/" + f.FileInfo.ID + "/download"
f.DownloadURL = f.APIURL + "/file/" + f.FileInfo.ID + "?download"
if strings.HasPrefix(f.FileInfo.MimeType, "image") {
return f.image()