fish2018/pansou · warning

[ ] hsid= 不支持的网盘平台

Error message

[%s] hsid=%s不支持的网盘平台: %s

What it means

This error is thrown when the API returned a share code successfully but buildShareURL returned an empty string, meaning the plugin does not recognize the platform value returned/passed for this hsid. It indicates an unsupported or mistyped cloud-drive platform identifier (e.g. something other than ali/quark/uc/baidu etc. that buildShareURL handles).

Solutions

  1. Log the offending platform value and add a case for it in buildShareURL if the platform should be supported
  2. Normalize/alias common platform spellings in buildShareURL (e.g. 'aliyun'→'ali', '夸克'→'quark')
  3. Validate the platform value at the caller level before invoking fetchShareLink
  4. Update the plugin if upstream introduced a new supported pan type

Example fix

// before
switch strings.ToLower(platform) {
case "ali":
	...
}
// after
switch p := strings.ToLower(strings.TrimSpace(platform)); p {
case "ali", "aliyun":
	...
case "quark":
	...
default:
	// leave returning "" so callers report 不支持的网盘平台: %s with the raw value
}
Defensive patterns

Strategy: validation

Validate before calling

supported := map[string]bool{"ali": true, "quark": true, "uc": true, "baidu": true}
if !supported[strings.ToLower(platform)] {
	return fmt.Errorf("platform %q is not supported", platform)
}

Type guard

func isSupportedPlatform(p string) bool {
	switch strings.ToLower(strings.TrimSpace(p)) {
	case "ali", "quark", "uc", "baidu":
		return true
	}
	return false
}

Try / catch

shareURL := buildShareURL(platform, apiResp.Data.ShareCode)
if shareURL == "" {
	log.Printf("skip hsid=%s: unsupported platform %q", hsid, platform)
	return "", "", fmt.Errorf("unsupported platform: %s", platform)
}

Prevention

When it happens

Trigger: fetchShareLink calls buildShareURL(platform, apiResp.Data.ShareCode) and gets "" back because strings.ToLower(platform) matches no case in the switch.

Common situations: Upstream added a new cloud-drive platform the plugin doesn't support yet; platform string casing/spelling mismatch (e.g. 'Aliyun' vs 'ali'); platform data corrupted or empty in the API response; caller passed a platform name in a different language.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07). Data as JSON: /api/errors/e09fb02f4abe002b. Report an issue: GitHub.

Appendix: source

Thrown at plugin/haisou/haisou.go:432

	if err != nil {
		return "", "", fmt.Errorf("[%s] hsid=%s读取响应失败: %w", p.Name(), hsid, err)
	}

	// 解析响应
	var apiResp FetchAPIResponse
	if err := json.Unmarshal(body, &apiResp); err != nil {
		return "", "", fmt.Errorf("[%s] hsid=%s链接JSON解析失败: %w", p.Name(), hsid, err)
	}

	// 检查API响应状态
	if apiResp.Code != 0 {
		return "", "", fmt.Errorf("[%s] hsid=%s链接API错误: %s", p.Name(), hsid, apiResp.Msg)
	}

	// 根据平台类型构建完整的分享链接
	shareURL := buildShareURL(platform, apiResp.Data.ShareCode)
	if shareURL == "" {
		return "", "", fmt.Errorf("[%s] hsid=%s不支持的网盘平台: %s", p.Name(), hsid, platform)
	}

	// 获取密码
	password := ""
	if apiResp.Data.SharePwd != nil {
		password = *apiResp.Data.SharePwd
	}

	if DebugLog {
		fmt.Printf("[%s] hsid=%s成功获取链接: %s password=%s\n", p.Name(), hsid, shareURL, password)
	}

	return shareURL, password, nil
}

// doRequestWithRetry 带重试机制的HTTP请求
func (p *HaisouPlugin) doRequestWithRetry(req *http.Request, client *http.Client) (*http.Response, error) {
	maxRetries := 3

View on GitHub (pinned to beaa561337)