url signing

This commit is contained in:
2025-03-16 11:24:00 +02:00
parent 34d50fde30
commit 07d574acd9
3 changed files with 64 additions and 4 deletions

View File

@@ -163,7 +163,7 @@ func (cfg *apiConfig) handlerUploadVideo(w http.ResponseWriter, r *http.Request)
return
}
url := fmt.Sprintf("http://%s.s3.%s.amazonaws.com/%s", cfg.s3Bucket, cfg.s3Region, fileName)
url := fmt.Sprintf("%s,%s", cfg.s3Bucket, fileName)
video.VideoURL = &url
@@ -179,5 +179,11 @@ func (cfg *apiConfig) handlerUploadVideo(w http.ResponseWriter, r *http.Request)
return
}
respondWithJSON(w, http.StatusOK, video)
vid, err := cfg.dbVideoToSignedVideo(video)
if err != nil {
respondWithError(w, http.StatusInternalServerError, "Couldn't convert video to signed video", err)
return
}
respondWithJSON(w, http.StatusOK, vid)
}