AlistGo/alist · warning
baidu youth locatedownload url is empty
Error message
baidu youth locatedownload url is empty
What it means
Defensive check in normalizeLocatedownloadURL (drivers/baidu_youth/util.go:364): it refuses to process an empty URL string. It only fires if a caller passes '' — the upstream callers (getLocatedownloadURL) already check resp.URL themselves, so seeing it means an internal contract violation or a new call path skipping the check.
Source
Thrown at drivers/baidu_youth/util.go:364
if err != nil {
return "", "", "", err
}
for _, listedFile := range files {
if listedFile.Path != file.GetPath() {
continue
}
fileID := strconv.FormatInt(listedFile.FsId, 10)
if listedFile.Path != "" && fileID != "" && listedFile.Md5 != "" {
return listedFile.Path, fileID, listedFile.Md5, nil
}
return "", "", "", fmt.Errorf("baidu youth list metadata incomplete for %s", file.GetPath())
}
return "", "", "", errs.NewErr(errs.ObjectNotFound, "baidu youth list metadata not found: %s", file.GetPath())
}
func normalizeLocatedownloadURL(rawURL string) (string, error) {
if rawURL == "" {
return "", fmt.Errorf("baidu youth locatedownload url is empty")
}
if !strings.Contains(rawURL, "response-cache-control=") {
sep := "&"
if !strings.Contains(rawURL, "?") {
sep = "?"
}
rawURL += sep + "response-cache-control=private"
}
return rawURL, nil
}
func (d *BaiduYouth) getMediaInfoDLink(ctx context.Context, file model.Obj) (string, error) {
path, fileID, _, err := d.resolveDownloadMeta(ctx, file)
if err != nil {
return "", err
}
var resp MediaInfoRespView on GitHub (pinned to 843d9dc814)
Solutions
- Check the URL is non-empty at the source (right after the API response) before normalizing
- Reuse getLocateDownloadURL, which performs the empty check on resp.URL, instead of calling the normalizer directly
Defensive patterns
Strategy: validation
Validate before calling
if rawURL == "" {
return "", fmt.Errorf("locatedownload returned no url for %s", file.GetPath())
}
return normalizeLocatedownloadURL(rawURL) Prevention
- Use the public getLocateDownloadURL flow; it already validates resp.URL
- In tests, feed the normalizer non-empty fixtures unless testing the guard itself
When it happens
Trigger: Directly calling normalizeLocatedownloadURL with an empty string; a future code path obtaining the URL from a different API that returned an empty field without checking first.
Common situations: Refactors adding new download URL sources; unit tests exercising the normalizer with zero values.
Related errors
- owner and repo are required
- invalid response
- committer email is required
- committer name is required
- author email is required
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/57bdebd706cdca93.
Report an issue: GitHub.