MCPcopy
hub / github.com/autobrr/qui / parseProxyMediaInfoContentPath

Function parseProxyMediaInfoContentPath

internal/proxy/handler.go:876–904  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

874}
875
876func parseProxyMediaInfoContentPath(r *http.Request) (string, error) {
877 queryContentPath := strings.TrimSpace(r.URL.Query().Get("contentPath"))
878 if queryContentPath == "" {
879 queryContentPath = strings.TrimSpace(r.URL.Query().Get("content_path"))
880 }
881 if queryContentPath != "" {
882 return normalizeContentPathRelativeInput(queryContentPath)
883 }
884
885 contentType := strings.TrimSpace(strings.ToLower(r.Header.Get("Content-Type")))
886 if strings.HasPrefix(contentType, "application/json") {
887 var req proxyContentPathMediaInfoRequest
888 if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
889 return "", errors.New("invalid request body")
890 }
891 return normalizeContentPathRelativeInput(req.ContentPath)
892 }
893
894 if err := r.ParseForm(); err != nil {
895 return "", errors.New("invalid form data")
896 }
897
898 contentPath := r.FormValue("contentPath")
899 if strings.TrimSpace(contentPath) == "" {
900 contentPath = r.FormValue("content_path")
901 }
902
903 return normalizeContentPathRelativeInput(contentPath)
904}
905
906func generateLoginCookieValue() (string, error) {
907 buf := make([]byte, 16)

Calls 2

GetMethod · 0.65