feat: limit file 50M

This commit is contained in:
yanghao05
2025-03-29 18:29:54 +08:00
parent 0d5f2e7de0
commit 8602ff0d0c

View File

@@ -245,13 +245,13 @@ func compressAudio(srcPath, dstPath string) error {
// compress video
func compressVideo(srcPath, dstPath string) error {
// if file size < 100M then copy
// if file size < 50M then copy
fileInfo, err := os.Stat(srcPath)
if err != nil {
return errors.Wrapf(err, "failed to get file info: %s", srcPath)
}
if fileInfo.Size() < 100*1024*1024 { // 100 MB
log.Infof("file size < 100M, copy file from %s to %s", srcPath, dstPath)
if fileInfo.Size() < 50*1024*1024 { // 50 MB
log.Infof("file size < 50M, copy file from %s to %s", srcPath, dstPath)
return copyFile(srcPath, dstPath)
}