Fix file permissions, still
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled

This commit is contained in:
2026-03-09 16:53:45 +00:00
parent 141ceab7e6
commit 7c980f1b1f
2 changed files with 11 additions and 0 deletions

View File

@@ -71,6 +71,14 @@ func (store *Store) UploadMessageFile(ctx *gin.Context) {
filename := hex.EncodeToString(b) + ext
uploadDir := "/backend/uploads/"
if err := os.MkdirAll(uploadDir, 0755); err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create upload directory"})
return
}
if err := os.Chmod(uploadDir, 0755); err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "failed to set directory permissions"})
return
}
dest := filepath.Join(uploadDir, filename)
if err := ctx.SaveUploadedFile(file, dest); err != nil {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "failed to save file"})