diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-03-01 13:26:24 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-03-01 13:26:24 +0300 |
commit | 77a49c65a81a74a0ce78805900ee4fb6b3a17b34 (patch) | |
tree | e0fb70cdf1276f351707d784af1f48255163f9d2 /internal/domain | |
parent | 48c69b669c940f751ba92466018aed3354ef9bd0 (diff) |
Add zip storage
Diffstat (limited to 'internal/domain')
-rw-r--r-- | internal/domain/domain.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go index daf43b40..72b2bc8b 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -361,7 +361,14 @@ func (d *D) ServeFileHTTP(w http.ResponseWriter, r *http.Request) bool { return true } - if d.tryFile(w, r, storage.New(project), subPath) == nil { + stor, err := storage.New(project) + if err != nil { + httperrors.Serve500(w) + return + } + defer store.Close() + + if d.tryFile(w, r, stor, subPath) == nil { return true } @@ -381,8 +388,15 @@ func (d *D) ServeNotFoundHTTP(w http.ResponseWriter, r *http.Request) { return } + stor, err := storage.New(project) + if err != nil { + httperrors.Serve500(w) + return + } + defer store.Close() + // Try serving custom not-found page - if d.tryNotFound(w, r, storage.New(project)) == nil { + if d.tryNotFound(w, r, stor) == nil { return } |