1
0
mirror of https://github.com/amir20/dozzle.git synced 2026-01-04 03:54:58 +01:00

Adds html5 download and changes mimetype

This commit is contained in:
Amir Raminfar
2021-01-05 16:59:51 -08:00
parent 72fabbb3fa
commit 4d4d8f549f
2 changed files with 7 additions and 2 deletions

View File

@@ -9,7 +9,12 @@
<container-stat :stat="container.stat" :state="container.state"></container-stat>
</div>
<div class="column is-narrow">
<a class="button is-small is-outlined" id="download" :href="`${base}/api/logs/download?id=${container.id}`">
<a
class="button is-small is-outlined"
id="download"
:href="`${base}/api/logs/download?id=${container.id}`"
download
>
<span class="icon">
<icon name="save"></icon>
</span>

View File

@@ -131,7 +131,7 @@ func (h *handler) downloadLogs(w http.ResponseWriter, r *http.Request) {
from := time.Unix(container.Created, 0)
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%v.log.gz", container.ID))
w.Header().Set("Content-Type", "application/octet-stream")
w.Header().Set("Content-Type", "application/gzip")
zw := gzip.NewWriter(w)
defer zw.Close()
zw.Name = fmt.Sprintf("%v.log", container.ID)