mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
Return error when scanning avif in zip (#6356)
This commit is contained in:
parent
69fd073d5d
commit
e213fde0cc
1 changed files with 4 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package image
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"path/filepath"
|
||||
|
|
@ -19,6 +20,8 @@ import (
|
|||
_ "golang.org/x/image/webp"
|
||||
)
|
||||
|
||||
var ErrUnsupportedAVIFInZip = errors.New("AVIF images in zip files is unsupported")
|
||||
|
||||
// Decorator adds image specific fields to a File.
|
||||
type Decorator struct {
|
||||
FFProbe *ffmpeg.FFProbe
|
||||
|
|
@ -32,8 +35,7 @@ func (d *Decorator) Decorate(ctx context.Context, fs models.FS, f models.File) (
|
|||
if _, isOs := fs.(*file.OsFS); !isOs {
|
||||
// AVIF images inside zip files are not supported
|
||||
if strings.ToLower(filepath.Ext(base.Path)) == ".avif" {
|
||||
logger.Warnf("Skipping AVIF image in zip file: %s", base.Path)
|
||||
return f, nil
|
||||
return nil, fmt.Errorf("%w: %s", ErrUnsupportedAVIFInZip, base.Path)
|
||||
}
|
||||
logger.Debugf("assuming ImageFile for non-OsFS file %q", base.Path)
|
||||
return decorateFallback(fs, f)
|
||||
|
|
|
|||
Loading…
Reference in a new issue