mirror of https://github.com/stashapp/stash.git
Handle folder symlinks correctly during clean (#3415)
This commit is contained in:
parent
f0988817c8
commit
3cf97f6e27
|
@ -5,6 +5,8 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/stashapp/stash/pkg/job"
|
||||
"github.com/stashapp/stash/pkg/logger"
|
||||
|
@ -351,6 +353,22 @@ func (j *cleanJob) shouldCleanFolder(ctx context.Context, f *Folder) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// #3261 - handle symlinks
|
||||
if info.Mode()&os.ModeSymlink == os.ModeSymlink {
|
||||
finalPath, err := filepath.EvalSymlinks(path)
|
||||
if err != nil {
|
||||
// don't bail out if symlink is invalid
|
||||
logger.Infof("Invalid symlink. Marking to clean: \"%s\"", path)
|
||||
return true
|
||||
}
|
||||
|
||||
info, err = j.FS.Lstat(finalPath)
|
||||
if err != nil {
|
||||
logger.Errorf("error getting file info for %q (-> %s), not cleaning: %v", path, finalPath, err)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// run through path filter, if returns false then the file should be cleaned
|
||||
filter := j.options.PathFilter
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* Changed performer aliases to be a list, rather than a string field. ([#3113](https://github.com/stashapp/stash/pull/3113))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
* Fixed folder symlinks not being handled correctly during clean. ([#3415](https://github.com/stashapp/stash/pull/3415))
|
||||
* Fixed error when clicking Scrape All when a file-less scene is in the scene list. ([#3414](https://github.com/stashapp/stash/pull/3414))
|
||||
* Fixed clicking popover pills not clearing search term. ([#3408](https://github.com/stashapp/stash/pull/3408))
|
||||
* Fixed URL not being preserved when redirected to login. ([#3305](https://github.com/stashapp/stash/pull/3305))
|
||||
|
|
Loading…
Reference in New Issue