This commit is contained in:
@@ -149,7 +149,7 @@ func (a *Admin) handleSettingsPhoto(w http.ResponseWriter, r *http.Request) {
|
||||
if !a.requireCSRF(w, r) {
|
||||
return
|
||||
}
|
||||
file, header, err := r.FormFile("photo")
|
||||
file, _, err := r.FormFile("photo")
|
||||
if err != nil {
|
||||
a.renderSettings(w, r, a.tr(r, "No file selected."), "", http.StatusUnprocessableEntity)
|
||||
return
|
||||
@@ -166,7 +166,10 @@ func (a *Admin) handleSettingsPhoto(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
username := a.currentUser(r)
|
||||
url, err := a.deps.Store.StoreUpload(header.Filename, raw)
|
||||
// The photo is account state, not library content: it is stored
|
||||
// under avatars/ inside the media directory, which the media
|
||||
// library never lists as a tile.
|
||||
url, err := a.deps.Store.StoreAvatar(raw)
|
||||
if err != nil {
|
||||
a.renderSettings(w, r, a.tr(r, "The photo could not be stored."), "", http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user