mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 20:07:05 +03:00
Improve handling of moved and added video files (#4598)
* If old file path is not in library, treat as move * Use existing phash if file with same oshash exists
This commit is contained in:
@@ -867,9 +867,11 @@ func (s *scanJob) handleRename(ctx context.Context, f models.File, fp []models.F
|
||||
continue
|
||||
}
|
||||
|
||||
if _, err := fs.Lstat(other.Base().Path); err != nil {
|
||||
info, err := fs.Lstat(other.Base().Path)
|
||||
switch {
|
||||
case err != nil:
|
||||
missing = append(missing, other)
|
||||
} else if strings.EqualFold(f.Base().Path, other.Base().Path) {
|
||||
case strings.EqualFold(f.Base().Path, other.Base().Path):
|
||||
// #1426 - if file exists but is a case-insensitive match for the
|
||||
// original filename, and the filesystem is case-insensitive
|
||||
// then treat it as a move
|
||||
@@ -877,6 +879,10 @@ func (s *scanJob) handleRename(ctx context.Context, f models.File, fp []models.F
|
||||
// treat as a move
|
||||
missing = append(missing, other)
|
||||
}
|
||||
case !s.acceptEntry(ctx, other.Base().Path, info):
|
||||
// #4393 - if the file is no longer in the configured library paths, treat it as a move
|
||||
logger.Debugf("File %q no longer in library paths. Treating as a move.", other.Base().Path)
|
||||
missing = append(missing, other)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user