From eb323110cf9d3c6773342fe3f1d627f1a7586ee6 Mon Sep 17 00:00:00 2001 From: kirari04 Date: Sun, 7 Jan 2024 17:17:00 +0100 Subject: [PATCH] fixed upload issue --- logic/CreateFile.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/logic/CreateFile.go b/logic/CreateFile.go index fe13c6c..d4c60ec 100755 --- a/logic/CreateFile.go +++ b/logic/CreateFile.go @@ -119,7 +119,7 @@ func CreateFile(fromFile *string, toFolder uint, fileName string, fileId string, } // check average framerate - if avgFramerate < 1 || avgFramerate > 120 { + if avgFramerate > 120 || avgFramerate < 0 { return fiber.StatusBadRequest, nil, false, errors.New("invalid video framerate") } @@ -153,16 +153,18 @@ func CreateFile(fromFile *string, toFolder uint, fileName string, fileId string, thumbnailFileName := "4x4.webp" go func() { - if _, err := CreateThumbnail( - 4, - *fromFile, - 1080, - thumbnailFileName, - fmt.Sprintf("%s/%s", config.ENV.FolderVideoQualitysPriv, fileId), - videoDuration, - avgFramerate, - ); err != nil { - log.Printf("Failed to generate thumbnail from file %v: %v", fromFile, err) + if avgFramerate > 0 { + if _, err := CreateThumbnail( + 4, + *fromFile, + 1080, + thumbnailFileName, + fmt.Sprintf("%s/%s", config.ENV.FolderVideoQualitysPriv, fileId), + videoDuration, + avgFramerate, + ); err != nil { + log.Printf("Failed to generate thumbnail from file %v: %v", fromFile, err) + } } }() var dbFile models.File