Skip to content

Commit

Permalink
Prefetch should also respect AllowedType
Browse files Browse the repository at this point in the history
  • Loading branch information
n0vad3v committed Mar 16, 2024
1 parent 58a094d commit f9485a2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions encoder/prefetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ func PrefetchImages() {
if info.IsDir() {
return nil
}
if !helper.CheckAllowedType(picAbsPath) {
return nil
}
// RawImagePath string, ImgFilename string, reqURI string
metadata := helper.ReadMetadata(picAbsPath, "", config.LocalHostAlias)
avifAbsPath, webpAbsPath, jxlAbsPath := helper.GenOptimizedAbsPath(metadata, config.LocalHostAlias)

// Using avifAbsPath here is the same as using webpAbsPath/jxlAbsPath
_ = os.MkdirAll(path.Dir(avifAbsPath), 0755)

log.Infof("Prefetching %s", picAbsPath)
go ConvertFilter(picAbsPath, jxlAbsPath, avifAbsPath, webpAbsPath, config.ExtraParams{Width: 0, Height: 0}, finishChan)
_ = bar.Add(<-finishChan)
Expand Down

0 comments on commit f9485a2

Please sign in to comment.