From dcff7b44e295381e946dca89c1835a2db2f7eec5 Mon Sep 17 00:00:00 2001 From: Lz Date: Fri, 6 Oct 2023 16:00:30 +0800 Subject: [PATCH] fix(upload): fixed file name issue in webstreaming --- zboxcore/sdk/chunked_upload_web_streaming.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/zboxcore/sdk/chunked_upload_web_streaming.go b/zboxcore/sdk/chunked_upload_web_streaming.go index 7b4694c60..75a75b489 100644 --- a/zboxcore/sdk/chunked_upload_web_streaming.go +++ b/zboxcore/sdk/chunked_upload_web_streaming.go @@ -21,7 +21,10 @@ func TranscodeWebStreaming(workdir string, fileReader io.Reader, fileMeta FileMe outDir := filepath.Join(workdir, ".zcn", "transcode") // create ./zcn/transcode folder if it doesn't exists os.MkdirAll(outDir, 0766) //nolint: errcheck - fileName := filepath.Join(outDir, fileMeta.RemoteName) + + remoteName, remotePath := getRemoteNameAndRemotePath(fileMeta.RemoteName, fileMeta.RemotePath) + + fileName := filepath.Join(outDir, remoteName) // w, err := os.Create(fileName) // if err != nil { @@ -72,8 +75,8 @@ func TranscodeWebStreaming(workdir string, fileReader io.Reader, fileMeta FileMe ActualSize: fi.Size(), ActualThumbnailSize: fileMeta.ActualThumbnailSize, ActualThumbnailHash: fileMeta.ActualThumbnailHash, - RemoteName: fileMeta.RemoteName, - RemotePath: fileMeta.RemotePath, + RemoteName: remoteName, + RemotePath: remotePath, } return r, fm, fileName, nil @@ -86,7 +89,7 @@ func getRemoteNameAndRemotePath(remoteName string, remotePath string) (string, s newRemoteNameSlice = newRemoteNameSlice[:len(newRemoteNameSlice)-1] } newRemoteNameWithoutType := strings.Join(newRemoteNameSlice, ".") - newRemoteName = "raw." + newRemoteNameWithoutType + ".mp4" + newRemoteName = newRemoteNameWithoutType + ".mp4" newRemotePath = newRemotePath + newRemoteName return newRemoteName, newRemotePath }