Skip to content

Commit

Permalink
fix: enhance filename handling in uploads to support unrecognized nam…
Browse files Browse the repository at this point in the history
…ing schemes
  • Loading branch information
PlusOne committed Jan 26, 2025
1 parent 09833ff commit afa6b61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1788,8 +1788,13 @@ func handleUpload(w http.ResponseWriter, r *http.Request, absFilename, fileStore

// Determine the final filename based on the FileNaming configuration
finalFilename := absFilename
if conf.Server.FileNaming == "HMAC" {
switch conf.Server.FileNaming {
case "HMAC":
finalFilename = filepath.Join(filepath.Dir(absFilename), hex.EncodeToString(calculatedMAC)+filepath.Ext(absFilename))
case "None", "none":
// Do nothing: keep finalFilename as-is
default:
log.Warnf("Unrecognized filenaming config %q, skipping rename.", conf.Server.FileNaming)
}

// Create temp file and write the uploaded data
Expand Down

0 comments on commit afa6b61

Please sign in to comment.