mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
File size scanning fixes (#1944)
This commit is contained in:
@@ -77,6 +77,7 @@ func (o Scanner) ScanExisting(existing FileBased, file SourceFile) (h *Scanned,
|
|||||||
// update existing data if needed
|
// update existing data if needed
|
||||||
// truncate to seconds, since we don't store beyond that in the database
|
// truncate to seconds, since we don't store beyond that in the database
|
||||||
updatedFile.FileModTime = info.ModTime().Truncate(time.Second)
|
updatedFile.FileModTime = info.ModTime().Truncate(time.Second)
|
||||||
|
updatedFile.Size = strconv.FormatInt(info.Size(), 10)
|
||||||
|
|
||||||
modTimeChanged := !existingFile.FileModTime.Equal(updatedFile.FileModTime)
|
modTimeChanged := !existingFile.FileModTime.Equal(updatedFile.FileModTime)
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ func (scanner *Scanner) ScanExisting(existing file.FileBased, file file.SourceFi
|
|||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we don't currently store sizes for gallery files
|
||||||
|
// clear the file size so that we don't incorrectly detect a
|
||||||
|
// change
|
||||||
|
scanned.New.Size = ""
|
||||||
|
|
||||||
retGallery = existing.(*models.Gallery)
|
retGallery = existing.(*models.Gallery)
|
||||||
|
|
||||||
path := scanned.New.Path
|
path := scanned.New.Path
|
||||||
@@ -51,8 +56,6 @@ func (scanner *Scanner) ScanExisting(existing file.FileBased, file file.SourceFi
|
|||||||
changed := false
|
changed := false
|
||||||
|
|
||||||
if scanned.ContentsChanged() {
|
if scanned.ContentsChanged() {
|
||||||
logger.Infof("%s has been updated: rescanning", path)
|
|
||||||
|
|
||||||
retGallery.SetFile(*scanned.New)
|
retGallery.SetFile(*scanned.New)
|
||||||
changed = true
|
changed = true
|
||||||
} else if scanned.FileUpdated() {
|
} else if scanned.FileUpdated() {
|
||||||
|
|||||||
Reference in New Issue
Block a user