mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +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
|
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) {
|
if isGallery(path) {
|
||||||
galleries = append(galleries, path)
|
galleries = append(galleries, path)
|
||||||
}
|
}
|
||||||
@@ -401,11 +411,6 @@ func (t *ScanTask) scanGallery() {
|
|||||||
// scan the zip files if the gallery has no images
|
// scan the zip files if the gallery has no images
|
||||||
scanImages = scanImages || images == 0
|
scanImages = scanImages || images == 0
|
||||||
} else {
|
} else {
|
||||||
// Ignore directories.
|
|
||||||
if isDir, _ := utils.DirExists(t.FilePath); isDir {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
checksum, err := t.calculateChecksum()
|
checksum, err := t.calculateChecksum()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err.Error())
|
logger.Error(err.Error())
|
||||||
@@ -729,11 +734,6 @@ func (t *ScanTask) scanScene() *models.Scene {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore directories.
|
|
||||||
if isDir, _ := utils.DirExists(t.FilePath); isDir {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath, t.StripFileExtension)
|
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath, t.StripFileExtension)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error(err.Error())
|
logger.Error(err.Error())
|
||||||
@@ -1059,11 +1059,6 @@ func (t *ScanTask) scanImage() {
|
|||||||
// check for thumbnails
|
// check for thumbnails
|
||||||
t.generateThumbnail(i)
|
t.generateThumbnail(i)
|
||||||
} else {
|
} else {
|
||||||
// Ignore directories.
|
|
||||||
if isDir, _ := utils.DirExists(t.FilePath); isDir {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var checksum string
|
var checksum string
|
||||||
|
|
||||||
logger.Infof("%s not found. Calculating checksum...", t.FilePath)
|
logger.Infof("%s not found. Calculating checksum...", t.FilePath)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
* Added sv-SE language option. ([#1691](https://github.com/stashapp/stash/pull/1691))
|
* Added sv-SE language option. ([#1691](https://github.com/stashapp/stash/pull/1691))
|
||||||
|
|
||||||
### 🐛 Bug fixes
|
### 🐛 Bug fixes
|
||||||
|
* Don't scan zero-length files. ([#1779](https://github.com/stashapp/stash/pull/1779))
|
||||||
* Accept svg files in file selector for tag images. ([#1778](https://github.com/stashapp/stash/pull/1778))
|
* Accept svg files in file selector for tag images. ([#1778](https://github.com/stashapp/stash/pull/1778))
|
||||||
* Fix criteria being incorrectly applied when clicking back button. ([#1765](https://github.com/stashapp/stash/pull/1765))
|
* Fix criteria being incorrectly applied when clicking back button. ([#1765](https://github.com/stashapp/stash/pull/1765))
|
||||||
* Show first page and fix order direction not being maintained when clicking on card popover button. ([#1765](https://github.com/stashapp/stash/pull/1765))
|
* Show first page and fix order direction not being maintained when clicking on card popover button. ([#1765](https://github.com/stashapp/stash/pull/1765))
|
||||||
|
|||||||
Reference in New Issue
Block a user