diff --git a/internal/web/ui.go b/internal/web/ui.go index 3d5fe95..d991e15 100644 --- a/internal/web/ui.go +++ b/internal/web/ui.go @@ -4041,15 +4041,7 @@ func (u *UI) actionFaceGalleryImport(w http.ResponseWriter, r *http.Request) { count := 0 for _, files := range r.MultipartForm.File { for _, hdr := range files { - // 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] - } - } + fullPath := fullFilename(hdr) parts := strings.Split(strings.ReplaceAll(fullPath, "\\", "/"), "/") if len(parts) < 2 { continue @@ -4082,12 +4074,7 @@ func (u *UI) actionFaceGalleryImport(w http.ResponseWriter, r *http.Request) { repo := storage.NewFaceGalleryRepo(u.dbPath) for _, files := range r.MultipartForm.File { for _, hdr := range files { - cd := hdr.Header.Get("Content-Disposition") - fp := hdr.Filename - if idx := strings.LastIndex(cd, `filename="`); idx >= 0 { - start := idx + len(`filename="`) - if end := strings.IndexByte(cd[start:], '"'); end >= 0 { fp = cd[start : start+end] } - } + fp := fullFilename(hdr) parts := strings.Split(strings.ReplaceAll(fp, "\\", "/"), "/") if len(parts) < 2 { continue } personName := strings.TrimSpace(parts[len(parts)-2])