Skip to content

Commit

Permalink
fix(upload): fixed file name issue in webstreaming
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlangzi committed Oct 6, 2023
1 parent 160f7df commit dcff7b4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions zboxcore/sdk/chunked_upload_web_streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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
}

0 comments on commit dcff7b4

Please sign in to comment.