change file permissions to /uploads
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m0s
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m0s
This commit is contained in:
@@ -48,6 +48,11 @@ func (store *Store) UploadMessageFile(ctx *gin.Context) {
|
|||||||
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create upload directory"})
|
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create upload directory"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// Ensure directory is world-readable so nginx can serve files
|
||||||
|
if err := os.Chmod(uploadDir, 0755); err != nil {
|
||||||
|
ctx.JSON(http.StatusInternalServerError, gin.H{"error": "failed to create upload directory"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
dest := filepath.Join(uploadDir, filename)
|
dest := filepath.Join(uploadDir, filename)
|
||||||
if err := ctx.SaveUploadedFile(file, dest); err != nil {
|
if err := ctx.SaveUploadedFile(file, dest); err != nil {
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ else
|
|||||||
envsubst '${DOMAIN}' < /etc/nginx/nginx_setup.conf.template > /etc/nginx/nginx.conf
|
envsubst '${DOMAIN}' < /etc/nginx/nginx_setup.conf.template > /etc/nginx/nginx.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure uploads are readable by nginx worker processes
|
# Ensure uploads directory and files are readable by nginx worker processes
|
||||||
|
chmod 755 /uploads 2>/dev/null || true
|
||||||
chmod -R a+rX /uploads 2>/dev/null || true
|
chmod -R a+rX /uploads 2>/dev/null || true
|
||||||
|
|
||||||
# Start nginx
|
# Start nginx
|
||||||
|
|||||||
Reference in New Issue
Block a user