fish2018/pansou · warning
密文长度为0
Error message
密文长度为0
What it means
DecryptURL decoded the Base64 successfully but the resulting ciphertext has zero length, so there is nothing to AES-decrypt. This guards against empty plaintext that would otherwise crash CBC decryption; the plugin counts the item as skipped.
Solutions
- Internal handling: the plugin skips the item; no caller action needed.
- If frequent, log sample item.URL values and inspect the source data for truncation upstream.
- Treat empty ciphertext the same as empty input: skip before Base64 decoding.
- Update the plugin if the site's encoding scheme changed such that legitimate values decode to empty.
Example fix
// before
enc := strings.TrimSpace(item.URL)
decryptedURL, err := DecryptURL(enc)
// after
enc := strings.TrimSpace(item.URL)
if enc == "" || enc == "====" {
skippedCount++
continue
}
decryptedURL, err := DecryptURL(enc) Defensive patterns
Strategy: validation
Validate before calling
if len(strings.Trim(item.URL, "=")) == 0 { /* skip: decodes to empty ciphertext */ } Try / catch
decryptedURL, err := DecryptURL(item.URL)
if err != nil {
skippedCount++
continue // empty/garbled ciphertext; move to next item
} Prevention
- Validate ciphertext length right after Base64 decoding
- Skip degenerate records early instead of decrypting
- Monitor skip rates to detect upstream data-quality regressions
When it happens
Trigger: item.URL contained only Base64 padding or decoded to an empty byte slice (e.g. the string "====" or an empty-after-trim value) and DecryptURL is called with it.
Common situations: Degenerate/corrupted records in the sdso search index; upstream truncation of the URL field; over-trimming of the input string before it reaches DecryptURL.
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/ceed8a7fab44915b.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/sdso/sdso.go:391
}
// 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块大小的倍数")
}
// 创建AES块加密器
block, err := aes.NewCipher([]byte(AESKey))
if err != nil {
return "", fmt.Errorf("创建AES加密器失败: %w", err)
}
// 创建CBC模式解密器
iv := []byte(AESIV)
if len(iv) != aes.BlockSize {
return "", fmt.Errorf("IV长度不正确: 期望%d,实际%d", aes.BlockSize, len(iv))
}View on GitHub (pinned to beaa561337)