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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -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
}

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))
### 🐛 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))