fix: remove photo_url text input from user form (photo only via file upload; handler keeps existing photo when no file); livewire config published (disk=local, 12MB, 2min upload — was 5s default breaking admin temp uploads)
This commit is contained in:
@@ -110,9 +110,9 @@ func (a *App) EditTag(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// Optional file upload: if a photo file is present, store it and use it;
|
||||
// otherwise fall back to the photo_url text value.
|
||||
photoURL := strings.TrimSpace(r.FormValue("photo_url"))
|
||||
// Photo: only change it when a NEW file is uploaded; otherwise keep the
|
||||
// tag's current photo (there is no photo_url text field anymore).
|
||||
photoURL := tag.PhotoUrl.String
|
||||
if err := r.ParseMultipartForm(10 << 20); err == nil {
|
||||
if file, header, ferr := r.FormFile("photo"); ferr == nil {
|
||||
ct := header.Header.Get("Content-Type")
|
||||
@@ -125,10 +125,8 @@ func (a *App) EditTag(w http.ResponseWriter, r *http.Request) {
|
||||
if perr := a.Storage.Put(r.Context(), key, file, header.Size, ct); perr == nil {
|
||||
photoURL = "/photos/" + key
|
||||
}
|
||||
file.Close()
|
||||
} else if ferr == nil {
|
||||
file.Close()
|
||||
}
|
||||
file.Close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user