mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Add move files external interface (#3557)
* Add moveFiles graphql mutation * Move library resolution code into config * Implement file moving * Log if old file not removed in SafeMove * Ensure extensions are consistent * Don't allow overwriting existing files
This commit is contained in:
@@ -164,9 +164,9 @@ func (f *cleanFilter) Accept(ctx context.Context, path string, info fs.FileInfo)
|
||||
|
||||
if info.IsDir() {
|
||||
fileOrFolder = "Folder"
|
||||
stash = getStashFromDirPath(f.stashPaths, path)
|
||||
stash = f.stashPaths.GetStashFromDirPath(path)
|
||||
} else {
|
||||
stash = getStashFromPath(f.stashPaths, path)
|
||||
stash = f.stashPaths.GetStashFromPath(path)
|
||||
}
|
||||
|
||||
if stash == nil {
|
||||
@@ -449,21 +449,3 @@ func (h *cleanHandler) handleRelatedImages(ctx context.Context, fileDeleter *fil
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func getStashFromPath(stashes []*config.StashConfig, pathToCheck string) *config.StashConfig {
|
||||
for _, f := range stashes {
|
||||
if fsutil.IsPathInDir(f.Path, filepath.Dir(pathToCheck)) {
|
||||
return f
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getStashFromDirPath(stashes []*config.StashConfig, pathToCheck string) *config.StashConfig {
|
||||
for _, f := range stashes {
|
||||
if fsutil.IsPathInDir(f.Path, pathToCheck) {
|
||||
return f
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user