MCPcopy
hub / github.com/pocketbase/pocketbase / extractPrefixedFiles

Function extractPrefixedFiles

apis/batch.go:456–483  ·  view source on GitHub ↗
(request *http.Request, prefixes ...string)

Source from the content-addressed store, hash-verified

454}
455
456func extractPrefixedFiles(request *http.Request, prefixes ...string) (map[string][]*filesystem.File, error) {
457 if request.MultipartForm == nil {
458 if err := request.ParseMultipartForm(router.DefaultMaxMemory); err != nil {
459 return nil, err
460 }
461 }
462
463 result := make(map[string][]*filesystem.File)
464
465 for k, fhs := range request.MultipartForm.File {
466 for _, p := range prefixes {
467 if strings.HasPrefix(k, p) {
468 resultKey := strings.TrimPrefix(k, p)
469
470 for _, fh := range fhs {
471 file, err := filesystem.NewFileFromMultipart(fh)
472 if err != nil {
473 return nil, err
474 }
475
476 result[resultKey] = append(result[resultKey], file)
477 }
478 }
479 }
480 }
481
482 return result, nil
483}
484
485func prepareInternalAction(activeApp core.App, ir *core.InternalRequest, optNext func(data any) error) (HandleFunc, map[string]string, bool) {
486 full := strings.ToUpper(ir.Method) + " " + ir.URL

Callers 1

batchTransactionFunction · 0.85

Calls 1

NewFileFromMultipartFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…