- Added normalizeImagePath() helper that strips legacy storage/ prefix - Applied in ViewEventExpenses, SaveExpense, UpdateExpense, EditExpense - Prevents double storage/storage/ in image URLs for old expenses
10 lines
357 B
Go
10 lines
357 B
Go
package handlers
|
|
|
|
import "strings"
|
|
|
|
// normalizeImagePath strips a legacy "storage/" prefix if present, so that
|
|
// the template can safely build "/storage/{filename}" URLs regardless of
|
|
// whether the database entry was stored as "uuid.jpg" or "storage/uuid.jpg".
|
|
func normalizeImagePath(path string) string {
|
|
return strings.TrimPrefix(path, "storage/")
|
|
}
|