diff --git a/internal/web/ui.go b/internal/web/ui.go index d116457..654a8d6 100644 --- a/internal/web/ui.go +++ b/internal/web/ui.go @@ -4032,8 +4032,16 @@ func (u *UI) actionFaceGalleryImport(w http.ResponseWriter, r *http.Request) { count := 0 for _, files := range r.MultipartForm.File { for _, hdr := range files { - // webkitdirectory paths can have varying depth, extract last dir as person name - parts := strings.Split(strings.ReplaceAll(hdr.Filename, "\\", "/"), "/") + // Go 1.20+ sanitizes hdr.Filename to basename only, parse raw Content-Disposition for full path + cd := hdr.Header.Get("Content-Disposition") + fullPath := hdr.Filename + if idx := strings.LastIndex(cd, `filename="`); idx >= 0 { + start := idx + len(`filename="`) + if end := strings.IndexByte(cd[start:], '"'); end >= 0 { + fullPath = cd[start : start+end] + } + } + parts := strings.Split(strings.ReplaceAll(fullPath, "\\", "/"), "/") if len(parts) < 2 { continue }