Compare commits
2 Commits
09c9ab8614
...
d913e0f7b2
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | d913e0f7b2 | |
Derrick Hammer | 8ccd90825b |
|
@ -2003,9 +2003,16 @@ func (s *S5API) downloadFile(jc jape.Context) {
|
||||||
detectedType, err := mimetype.DetectReader(file)
|
detectedType, err := mimetype.DetectReader(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Error("error detecting mime type", zap.Error(err))
|
s.logger.Error("error detecting mime type", zap.Error(err))
|
||||||
|
_ = jc.Error(err, http.StatusInternalServerError)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
_ = jc.Error(err, http.StatusInternalServerError)
|
|
||||||
mimeType = detectedType.String()
|
mimeType = detectedType.String()
|
||||||
|
_, err = file.Seek(0, io.SeekStart)
|
||||||
|
if err != nil {
|
||||||
|
s.logger.Error("error seeking file", zap.Error(err))
|
||||||
|
_ = jc.Error(err, http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(mimeType) == 0 {
|
if len(mimeType) == 0 {
|
||||||
|
|
Loading…
Reference in New Issue