Scan now uses exclude regex on gallery zips (#2317)

* Fix zip galleries not using regex excludes
This commit is contained in:
DampToast
2022-02-15 20:46:35 -06:00
committed by GitHub
parent 3fdc32b432
commit 9321388770
2 changed files with 14 additions and 5 deletions

View File

@@ -2,6 +2,8 @@ package manager
import ( import (
"archive/zip" "archive/zip"
"github.com/stashapp/stash/pkg/file"
"github.com/stashapp/stash/pkg/manager/config"
"strings" "strings"
"github.com/stashapp/stash/pkg/logger" "github.com/stashapp/stash/pkg/logger"
@@ -14,20 +16,26 @@ func walkGalleryZip(path string, walkFunc func(file *zip.File) error) error {
} }
defer readCloser.Close() defer readCloser.Close()
for _, file := range readCloser.File { excludeImgRegex := generateRegexps(config.GetInstance().GetImageExcludes())
if file.FileInfo().IsDir() {
for _, f := range readCloser.File {
if f.FileInfo().IsDir() {
continue continue
} }
if strings.Contains(file.Name, "__MACOSX") { if strings.Contains(f.Name, "__MACOSX") {
continue continue
} }
if !isImage(file.Name) { if !isImage(f.Name) {
continue continue
} }
err := walkFunc(file) if matchFileRegex(file.ZipFile(path, f).Path(), excludeImgRegex) {
continue
}
err := walkFunc(f)
if err != nil { if err != nil {
return err return err
} }

View File

@@ -15,6 +15,7 @@
* Show counts on list tabs in Performer, Studio and Tag pages. ([#2169](https://github.com/stashapp/stash/pull/2169)) * Show counts on list tabs in Performer, Studio and Tag pages. ([#2169](https://github.com/stashapp/stash/pull/2169))
### 🐛 Bug fixes ### 🐛 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)) * 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)) * 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)) * Allow Stash to be iframed. ([#2217](https://github.com/stashapp/stash/pull/2217))