refactor: fix nolint comment
This commit is contained in:
parent
223182cc0d
commit
81c412e6ef
@ -86,15 +86,14 @@ export default {
|
||||
download () {
|
||||
return `${baseURL}/api/raw${this.req.path}?auth=${this.jwt}`
|
||||
},
|
||||
thumbnail () {
|
||||
previewUrl () {
|
||||
if (this.req.type === 'image') {
|
||||
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 () {
|
||||
return `${this.thumbnail}&inline=true`
|
||||
return `${this.previewUrl}&inline=true`
|
||||
}
|
||||
},
|
||||
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) {
|
||||
format, err := imaging.FormatFromExtension(file.Extension)
|
||||
if err != nil {
|
||||
// Unsupported extensions directly return the raw data
|
||||
if file.Extension == ".ico" || file.Extension == ".svg" {
|
||||
if err == imaging.ErrUnsupportedFormat {
|
||||
return rawFileHandler(w, r, file)
|
||||
}
|
||||
return errToStatus(err), err
|
||||
}
|
||||
|
||||
var imgProcessor imageProcessor
|
||||
switch size {
|
||||
@ -74,10 +78,7 @@ func handleImagePreview(w http.ResponseWriter, r *http.Request, file *files.File
|
||||
return errToStatus(err), err
|
||||
}
|
||||
defer fd.Close()
|
||||
format, err := imaging.FormatFromExtension(file.Extension)
|
||||
if err != nil {
|
||||
return http.StatusNotImplemented, err
|
||||
}
|
||||
|
||||
img, err := imaging.Decode(fd, imaging.AutoOrientation(true))
|
||||
if err != nil {
|
||||
return errToStatus(err), err
|
||||
|
||||
@ -22,7 +22,7 @@ func parseQueryFiles(r *http.Request, f *files.FileInfo, _ *users.User) ([]strin
|
||||
fileSlice = append(fileSlice, f.Path)
|
||||
} else {
|
||||
for _, name := range names {
|
||||
name, err := url.QueryUnescape(strings.Replace(name, "+", "%2B", -1)) // nolint:shadow
|
||||
name, err := url.QueryUnescape(strings.Replace(name, "+", "%2B", -1)) //nolint:shadow
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -35,7 +35,7 @@ func parseQueryFiles(r *http.Request, f *files.FileInfo, _ *users.User) ([]strin
|
||||
return fileSlice, nil
|
||||
}
|
||||
|
||||
// nolint: goconst
|
||||
//nolint: goconst
|
||||
func parseQueryAlgorithm(r *http.Request) (string, archiver.Writer, error) {
|
||||
// TODO: use enum
|
||||
switch r.URL.Query().Get("algo") {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user