mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-11-26 22:20:18 +01:00
ISSUE-241 check metadata on preview
This commit is contained in:
parent
4a1697ee60
commit
2ee646590d
1 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue