{"record":{"id":"e1fe0a408537a226","repo":"AlistGo/alist","slug":"lark-download-requires-web-proxy","errorCode":null,"errorMessage":"lark download requires web proxy","messagePattern":"lark download requires web proxy","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/lark/driver.go","lineNumber":418,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t_ = ar.Body.Close()\n\t\t}\n\n\t\tif ar.StatusCode != http.StatusPartialContent {\n\t\t\treturn nil, errors.New(\"failed to get download link\")\n\t\t}\n\n\t\treturn &model.Link{\n\t\t\tURL: url,\n\t\t\tHeader: http.Header{\n\t\t\t\t\"Authorization\": []string{fmt.Sprintf(\"Bearer %s\", accessToken)},\n\t\t\t},\n\t\t}, nil\n\t}\n\n\treturn nil, errors.New(\"lark download requires web proxy\")\n}\n\nfunc (c *Lark) filePreviewURL(token string) string {\n\tprefix := strings.TrimRight(strings.TrimSpace(c.TenantUrlPrefix), \"/\")\n\tif prefix == \"\" {\n\t\tprefix = \"https://www.feishu.cn\"\n\t}\n\treturn prefix + \"/file/\" + token\n}\n\nfunc (c *Lark) downloadAccessToken(ctx context.Context, forceRefresh bool) (string, error) {\n\tvar accessToken string\n\tvar err error\n\tif strings.TrimSpace(c.RefreshToken) != \"\" || strings.TrimSpace(c.UserAccessToken) != \"\" {\n\t\taccessToken, err = c.ensureUserAccessToken(ctx, forceRefresh)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}","sourceCodeStart":400,"sourceCodeEnd":436,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/lark/driver.go#L400-L436","documentation":"Terminal branch of Lark.Link(): Feishu download URLs require the Authorization header, which browsers/clients cannot attach to a raw URL, so direct linking is impossible. Unless WebProxy is true (the branch above that proxies via alist with the Bearer header), the driver refuses with this error rather than returning a link that would 401.","triggerScenarios":"Link() called on any file while c.WebProxy == false. The direct-URL path is skipped entirely; there is no fallback.","commonSituations":"Freshly added Lark storage where 'web proxy'/'webdav proxy' option was left off; user expects 302-style redirects like other drivers provide.","solutions":["Enable the WebProxy option in the Lark storage settings and retry the download","If proxying is undesired, use the preview URL (filePreviewURL) for doc-like files instead of download","For native docs, use the export task flow to obtain a downloadable file"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if !c.WebProxy {\n\treturn nil, errors.New(\"lark downloads require the web proxy option; enable it in storage settings\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable WebProxy at storage creation time if downloads are expected","Document to users that Lark cannot do header-less 302 downloads by design"],"tags":["lark","feishu","download","config","driver"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}