refactor: fix nolint comment
This commit is contained in:
parent
223182cc0d
commit
81c412e6ef
@ -86,15 +86,14 @@ export default {
|
|||||||
download () {
|
download () {
|
||||||
return `${baseURL}/api/raw${this.req.path}?auth=${this.jwt}`
|
return `${baseURL}/api/raw${this.req.path}?auth=${this.jwt}`
|
||||||
},
|
},
|
||||||
thumbnail () {
|
previewUrl () {
|
||||||
if (this.req.type === 'image') {
|
if (this.req.type === 'image') {
|
||||||
return `${baseURL}/api/preview/big${this.req.path}?auth=${this.jwt}`
|
return `${baseURL}/api/preview/big${this.req.path}?auth=${this.jwt}`
|
||||||
} else {
|
|
||||||
return `${baseURL}/api/raw${this.req.path}?auth=${this.jwt}`
|
|
||||||
}
|
}
|
||||||
|
return `${baseURL}/api/raw${this.req.path}?auth=${this.jwt}`
|
||||||
},
|
},
|
||||||
raw () {
|
raw () {
|
||||||
return `${this.thumbnail}&inline=true`
|
return `${this.previewUrl}&inline=true`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted () {
|
async mounted () {
|
||||||
|
|||||||
@ -50,10 +50,14 @@ var previewHandler = withUser(func(w http.ResponseWriter, r *http.Request, d *da
|
|||||||
})
|
})
|
||||||
|
|
||||||
func handleImagePreview(w http.ResponseWriter, r *http.Request, file *files.FileInfo, size string) (int, error) {
|
func handleImagePreview(w http.ResponseWriter, r *http.Request, file *files.FileInfo, size string) (int, error) {
|
||||||
|
format, err := imaging.FormatFromExtension(file.Extension)
|
||||||
|
if err != nil {
|
||||||
// Unsupported extensions directly return the raw data
|
// Unsupported extensions directly return the raw data
|
||||||
if file.Extension == ".ico" || file.Extension == ".svg" {
|
if err == imaging.ErrUnsupportedFormat {
|
||||||
return rawFileHandler(w, r, file)
|
return rawFileHandler(w, r, file)
|
||||||
}
|
}
|
||||||
|
return errToStatus(err), err
|
||||||
|
}
|
||||||
|
|
||||||
var imgProcessor imageProcessor
|
var imgProcessor imageProcessor
|
||||||
switch size {
|
switch size {
|
||||||
@ -74,10 +78,7 @@ func handleImagePreview(w http.ResponseWriter, r *http.Request, file *files.File
|
|||||||
return errToStatus(err), err
|
return errToStatus(err), err
|
||||||
}
|
}
|
||||||
defer fd.Close()
|
defer fd.Close()
|
||||||
format, err := imaging.FormatFromExtension(file.Extension)
|
|
||||||
if err != nil {
|
|
||||||
return http.StatusNotImplemented, err
|
|
||||||
}
|
|
||||||
img, err := imaging.Decode(fd, imaging.AutoOrientation(true))
|
img, err := imaging.Decode(fd, imaging.AutoOrientation(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errToStatus(err), err
|
return errToStatus(err), err
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user