mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Don't scan zero length files or directories (#1779)
* Don't scan zero length files or directories
This commit is contained in:
@@ -83,6 +83,16 @@ func (j *ScanJob) Execute(ctx context.Context, progress *job.Progress) {
|
||||
return stoppingErr
|
||||
}
|
||||
|
||||
// #1756 - skip zero length files and directories
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
if info.Size() == 0 {
|
||||
logger.Infof("Skipping zero-length file: %s", path)
|
||||
return nil
|
||||
}
|
||||
|
||||
if isGallery(path) {
|
||||
galleries = append(galleries, path)
|
||||
}
|
||||
@@ -401,11 +411,6 @@ func (t *ScanTask) scanGallery() {
|
||||
// scan the zip files if the gallery has no images
|
||||
scanImages = scanImages || images == 0
|
||||
} else {
|
||||
// Ignore directories.
|
||||
if isDir, _ := utils.DirExists(t.FilePath); isDir {
|
||||
return
|
||||
}
|
||||
|
||||
checksum, err := t.calculateChecksum()
|
||||
if err != nil {
|
||||
logger.Error(err.Error())
|
||||
@@ -729,11 +734,6 @@ func (t *ScanTask) scanScene() *models.Scene {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Ignore directories.
|
||||
if isDir, _ := utils.DirExists(t.FilePath); isDir {
|
||||
return nil
|
||||
}
|
||||
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath, t.StripFileExtension)
|
||||
if err != nil {
|
||||
logger.Error(err.Error())
|
||||
@@ -1059,11 +1059,6 @@ func (t *ScanTask) scanImage() {
|
||||
// check for thumbnails
|
||||
t.generateThumbnail(i)
|
||||
} else {
|
||||
// Ignore directories.
|
||||
if isDir, _ := utils.DirExists(t.FilePath); isDir {
|
||||
return
|
||||
}
|
||||
|
||||
var checksum string
|
||||
|
||||
logger.Infof("%s not found. Calculating checksum...", t.FilePath)
|
||||
|
||||
Reference in New Issue
Block a user