{"record":{"id":"f056f0e61ba5bfa7","repo":"mickael-kerjean/filestash","slug":"http-error-d","errorCode":null,"errorMessage":"HTTP Error %d","messagePattern":"HTTP Error (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/plugin/plg_backend_url/index.go","lineNumber":105,"sourceCode":"}\n\nfunc (this *Url) Ls(path string) ([]os.FileInfo, error) {\n\tthis.root.Path = path\n\tif strings.HasSuffix(this.root.Path, \"/\") == false {\n\t\tthis.root.Path += \"/\"\n\t}\n\tresp, err := this.request(http.MethodGet, this.root.String(), \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\tif resp.StatusCode == http.StatusNotFound {\n\t\t\treturn nil, ErrNotFound\n\t\t} else if resp.StatusCode == http.StatusForbidden {\n\t\t\treturn nil, ErrNotAllowed\n\t\t}\n\t\treturn nil, fmt.Errorf(\"HTTP Error %d\", resp.StatusCode)\n\t}\n\tutf8Body, err := charset.NewReader(resp.Body, resp.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdoc, err := html.Parse(utf8Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar links []os.FileInfo\n\tvar crawler func(*html.Node)\n\tcrawler = func(node *html.Node) {\n\t\tif node.Type == html.ElementNode && slices.Contains([]string{\"a\", \"img\", \"object\", \"iframe\"}, strings.ToLower(node.Data)) {\n\t\t\tfor _, attr := range node.Attr {\n\t\t\t\tlink := \"\"\n\t\t\t\tif strings.ToLower(attr.Key) == \"href\" {\n\t\t\t\t\tlink = attr.Val\n\t\t\t\t}","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/mickael-kerjean/filestash/blob/78f756eb94ef383f1f1cd4bc3077a43a4d088ff0/server/plugin/plg_backend_url/index.go#L87-L123","documentation":"Thrown by the URL backend's Ls when an HTTP GET on the target URL returns a status that is neither 200, 404 (mapped to ErrNotFound), nor 403 (mapped to ErrNotAllowed). It is a catch-all for other HTTP failures — 5xx server errors, redirects gone wrong, 429 rate limiting — encountered while listing a remote URL as a filesystem.","triggerScenarios":"Thrown at server/plugin/plg_backend_url/index.go:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the reported status code: 5xx means the remote server failed, retry later; 429 means rate limiting, back off","Confirm the URL is correct and resolves to a directory-style listing (index page), not an unexpected endpoint","Follow redirects explicitly if the remote returns 3xx after redirects are exhausted","Handle known codes with dedicated errors (like 404/403 already are) to give callers precise semantics"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f756eb94ef383f1f1cd4bc3077a43a4d088ff0","analyzedAt":"2026-09-06T11:52:48.712Z","contentChangedAt":"2026-09-06T11:52:48.712Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}