Skip to content

Commit

Permalink
fixed upload issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirari04 committed Jan 7, 2024
1 parent 470985e commit eb32311
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions logic/CreateFile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eb32311

Please sign in to comment.