Removed redundant isImage check

This commit is contained in:
Seednode 2023-09-10 11:27:55 -05:00
parent 30eead7e2f
commit d869a375ab
2 changed files with 9 additions and 13 deletions

View File

@ -17,7 +17,7 @@ var (
)
const (
Version string = "0.59.3"
Version string = "0.59.4"
)
var (

View File

@ -990,17 +990,13 @@ func serveImage(paths []string, Regexes *Regexes, index *Index) httprouter.Handl
return
}
var dimensions *Dimensions
dimensions, err := imageDimensions(filePath)
if err != nil {
fmt.Println(err)
if image {
dimensions, err = imageDimensions(filePath)
if err != nil {
fmt.Println(err)
serverError(w, r, nil)
serverError(w, r, nil)
return
}
return
}
fileName := filepath.Base(filePath)
@ -1114,7 +1110,7 @@ func ServePage(args []string) error {
list: []string{},
}
Regexes := &Regexes{
regexes := &Regexes{
filename: regexp.MustCompile(`(.+)([0-9]{3})(\..+)`),
alphanumeric: regexp.MustCompile(`^[A-z0-9]*$`),
}
@ -1137,13 +1133,13 @@ func ServePage(args []string) error {
mux.PanicHandler = serverErrorHandler()
mux.GET("/", serveRoot(paths, Regexes, index))
mux.GET("/", serveRoot(paths, regexes, index))
mux.GET("/favicons/*favicon", serveFavicons())
mux.GET("/favicon.ico", serveFavicons())
mux.GET(ImagePrefix+"/*image", serveImage(paths, Regexes, index))
mux.GET(ImagePrefix+"/*image", serveImage(paths, regexes, index))
mux.GET(SourcePrefix+"/*static", serveStaticFile(paths, stats, index))