fish2018/pansou · warning

加密URL不能为空

Error message

加密URL不能为空

What it means

DecryptURL validates its input before AES decryption and rejects an empty encrypted URL string. Each search result item's URL is passed here; an empty URL means the API returned a list item with no encrypted link, which the plugin skips (counted as skippedCount).

Solutions

  1. This is handled internally: the plugin skips the item and continues, so no caller action is needed.
  2. If many items trigger this, check whether the API moved the encrypted link to a different JSON field and update APIResponse/item structs.
  3. Filter empty-URL items before calling DecryptURL to keep skip counts clean.
  4. Report persistent occurrences as a data-quality issue with the sdso.top source.

Example fix

// before
decryptedURL, err := DecryptURL(item.URL)
// after
if item.URL == "" {
    skippedCount++
    continue
}
decryptedURL, err := DecryptURL(item.URL)
Defensive patterns

Strategy: validation

Validate before calling

if item.URL == "" { /* skip item before calling DecryptURL */ }

Prevention

When it happens

Trigger: An item in apiResp.Data.List has item.URL == "" — the sdso API returned a result record lacking its encrypted link field, and fetchSinglePageWithType calls DecryptURL(item.URL) on it.

Common situations: The site's API returning placeholder/incomplete records for some shares; deleted shares still appearing in the index with the URL field blank; API contract changes where the link moved to a different JSON field.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at plugin/sdso/sdso.go:380

		if err == nil && resp.StatusCode == 200 {
			return resp, nil
		}

		if resp != nil {
			resp.Body.Close()
		}
		lastErr = err
	}

	return nil, fmt.Errorf("重试 %d 次后仍然失败: %w", maxRetries, lastErr)
}

// DecryptURL 解密SDSO网站返回的加密URL
// 输入: Base64编码的密文
// 输出: 解密后的原始网盘链接
func DecryptURL(encryptedURL string) (string, error) {
	if encryptedURL == "" {
		return "", fmt.Errorf("加密URL不能为空")
	}

	// Base64解码
	ciphertext, err := base64.StdEncoding.DecodeString(encryptedURL)
	if err != nil {
		return "", fmt.Errorf("Base64解码失败: %w", err)
	}

	// 检查密文长度
	if len(ciphertext) == 0 {
		return "", fmt.Errorf("密文长度为0")
	}

	// 检查密文长度是否为16的倍数
	if len(ciphertext)%aes.BlockSize != 0 {
		return "", fmt.Errorf("密文长度不是AES块大小的倍数")
	}

View on GitHub (pinned to beaa561337)