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,9 +50,13 @@ 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) {
|
||||||
// Unsupported extensions directly return the raw data
|
format, err := imaging.FormatFromExtension(file.Extension)
|
||||||
if file.Extension == ".ico" || file.Extension == ".svg" {
|
if err != nil {
|
||||||
return rawFileHandler(w, r, file)
|
// Unsupported extensions directly return the raw data
|
||||||
|
if err == imaging.ErrUnsupportedFormat {
|
||||||
|
return rawFileHandler(w, r, file)
|
||||||
|
}
|
||||||
|
return errToStatus(err), err
|
||||||
}
|
}
|
||||||
|
|
||||||
var imgProcessor imageProcessor
|
var imgProcessor imageProcessor
|
||||||
@ -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
|
||||||
|
|||||||
@ -22,7 +22,7 @@ func parseQueryFiles(r *http.Request, f *files.FileInfo, _ *users.User) ([]strin
|
|||||||
fileSlice = append(fileSlice, f.Path)
|
fileSlice = append(fileSlice, f.Path)
|
||||||
} else {
|
} else {
|
||||||
for _, name := range names {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ func parseQueryFiles(r *http.Request, f *files.FileInfo, _ *users.User) ([]strin
|
|||||||
return fileSlice, nil
|
return fileSlice, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint: goconst
|
//nolint: goconst
|
||||||
func parseQueryAlgorithm(r *http.Request) (string, archiver.Writer, error) {
|
func parseQueryAlgorithm(r *http.Request) (string, archiver.Writer, error) {
|
||||||
// TODO: use enum
|
// TODO: use enum
|
||||||
switch r.URL.Query().Get("algo") {
|
switch r.URL.Query().Get("algo") {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user