diff --git a/pkg/manager/image.go b/pkg/manager/image.go index ac319569e..5c45c12c8 100644 --- a/pkg/manager/image.go +++ b/pkg/manager/image.go @@ -2,6 +2,8 @@ package manager import ( "archive/zip" + "github.com/stashapp/stash/pkg/file" + "github.com/stashapp/stash/pkg/manager/config" "strings" "github.com/stashapp/stash/pkg/logger" @@ -14,20 +16,26 @@ func walkGalleryZip(path string, walkFunc func(file *zip.File) error) error { } defer readCloser.Close() - for _, file := range readCloser.File { - if file.FileInfo().IsDir() { + excludeImgRegex := generateRegexps(config.GetInstance().GetImageExcludes()) + + for _, f := range readCloser.File { + if f.FileInfo().IsDir() { continue } - if strings.Contains(file.Name, "__MACOSX") { + if strings.Contains(f.Name, "__MACOSX") { continue } - if !isImage(file.Name) { + if !isImage(f.Name) { continue } - err := walkFunc(file) + if matchFileRegex(file.ZipFile(path, f).Path(), excludeImgRegex) { + continue + } + + err := walkFunc(f) if err != nil { return err } diff --git a/ui/v2.5/src/components/Changelog/versions/v0130.md b/ui/v2.5/src/components/Changelog/versions/v0130.md index 4bfadafb7..1cfec15c9 100644 --- a/ui/v2.5/src/components/Changelog/versions/v0130.md +++ b/ui/v2.5/src/components/Changelog/versions/v0130.md @@ -15,6 +15,7 @@ * Show counts on list tabs in Performer, Studio and Tag pages. ([#2169](https://github.com/stashapp/stash/pull/2169)) ### 🐛 Bug fixes +* Fix image exclude regex not being honoured when scanning in zips. ([#2317](https://github.com/stashapp/stash/pull/2317)) * Delete funscripts when deleting scene files. ([#2265](https://github.com/stashapp/stash/pull/2265)) * Removed trusted proxies setting. ([#2229](https://github.com/stashapp/stash/pull/2229)) * Allow Stash to be iframed. ([#2217](https://github.com/stashapp/stash/pull/2217))