mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Skip validation of existing paths when adding new paths (#1301)
This commit is contained in:
@@ -25,11 +25,22 @@ func (r *mutationResolver) Migrate(ctx context.Context, input models.MigrateInpu
|
||||
|
||||
func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input models.ConfigGeneralInput) (*models.ConfigGeneralResult, error) {
|
||||
c := config.GetInstance()
|
||||
existingPaths := c.GetStashPaths()
|
||||
if len(input.Stashes) > 0 {
|
||||
for _, s := range input.Stashes {
|
||||
exists, err := utils.DirExists(s.Path)
|
||||
if !exists {
|
||||
return makeConfigGeneralResult(), err
|
||||
// Only validate existence of new paths
|
||||
isNew := true
|
||||
for _, path := range existingPaths {
|
||||
if path.Path == s.Path {
|
||||
isNew = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if isNew {
|
||||
exists, err := utils.DirExists(s.Path)
|
||||
if !exists {
|
||||
return makeConfigGeneralResult(), err
|
||||
}
|
||||
}
|
||||
}
|
||||
c.Set(config.Stash, input.Stashes)
|
||||
|
||||
Reference in New Issue
Block a user