1
0
mirror of https://github.com/dutchcoders/transfer.sh.git synced 2020-11-18 19:53:40 -08:00

Merge pull request #245 from dutchcoders/ISSUE-241

ISSUE-241 check metadata on preview
This commit is contained in:
Andrea Spacca 2019-07-06 20:23:24 +02:00 committed by GitHub
commit 8a3b87c9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,6 +102,14 @@ func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
token := vars["token"]
filename := vars["filename"]
_, err := s.CheckMetadata(token, filename, false)
if err != nil {
log.Printf("Error metadata: %s", err.Error())
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return
}
contentType, contentLength, err := s.storage.Head(token, filename)
if err != nil {
http.Error(w, http.StatusText(404), 404)