{"record":{"id":"2cbcde2c7f86ffd8","repo":"fish2018/pansou","slug":"base64-w","errorCode":null,"errorMessage":"Base64解码失败: %w","messagePattern":"Base64解码失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"plugin/sdso/sdso.go","lineNumber":386,"sourceCode":"\t\t}\n\t\tlastErr = err\n\t}\n\n\treturn nil, fmt.Errorf(\"重试 %d 次后仍然失败: %w\", maxRetries, lastErr)\n}\n\n// DecryptURL 解密SDSO网站返回的加密URL\n// 输入: Base64编码的密文\n// 输出: 解密后的原始网盘链接\nfunc DecryptURL(encryptedURL string) (string, error) {\n\tif encryptedURL == \"\" {\n\t\treturn \"\", fmt.Errorf(\"加密URL不能为空\")\n\t}\n\n\t// Base64解码\n\tciphertext, err := base64.StdEncoding.DecodeString(encryptedURL)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Base64解码失败: %w\", err)\n\t}\n\n\t// 检查密文长度\n\tif len(ciphertext) == 0 {\n\t\treturn \"\", fmt.Errorf(\"密文长度为0\")\n\t}\n\n\t// 检查密文长度是否为16的倍数\n\tif len(ciphertext)%aes.BlockSize != 0 {\n\t\treturn \"\", fmt.Errorf(\"密文长度不是AES块大小的倍数\")\n\t}\n\n\t// 创建AES块加密器\n\tblock, err := aes.NewCipher([]byte(AESKey))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"创建AES加密器失败: %w\", err)\n\t}\n","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/sdso/sdso.go#L368-L404","documentation":"DecryptURL failed to Base64-decode the item.URL value using base64.StdEncoding. The sdso API is expected to return standard-Base64-encoded AES ciphertext; anything else (raw URLs, URL-safe Base64, whitespace, HTML fragments) fails decoding. The plugin skips such items.","triggerScenarios":"item.URL contains characters outside the standard Base64 alphabet or wrong padding, e.g. the API returned a plaintext link, URL-safe Base64 (-/ instead of +/), a padded-with-whitespace value, or an HTML-escaped string.","commonSituations":"The site changing its encryption/encoding scheme (e.g. switching to URL-safe Base64 or raw URLs) after a frontend update; individual corrupted records in the search index; HTML escaping of + and / characters.","solutions":["Internal handling: the plugin skips the failing item — no caller action required.","If nearly all items fail, the site likely changed encoding: try base64.RawStdEncoding or base64.URLEncoding in DecryptURL.","Dump a sample item.URL (DebugLog) and verify its encoding manually.","Check whether sdso.top now returns plaintext links, making decryption obsolete."],"exampleFix":"// before\nciphertext, err := base64.StdEncoding.DecodeString(encryptedURL)\n// after\nciphertext, err := base64.StdEncoding.DecodeString(encryptedURL)\nif err != nil {\n    ciphertext, err = base64.URLEncoding.DecodeString(encryptedURL)\n}\nif err != nil {\n    return \"\", fmt.Errorf(\"Base64解码失败: %w\", err)\n}","handlingStrategy":"validation","validationCode":"// quick Base64 sanity check before decrypting\nif _, err := base64.StdEncoding.DecodeString(item.URL); err != nil { /* skip: not standard Base64 */ }","typeGuard":null,"tryCatchPattern":"decryptedURL, err := DecryptURL(item.URL)\nif err != nil {\n    log.Printf(\"skipping item (decode failed): %v\", err)\n    return nil // or continue to next item\n}","preventionTips":["Trim whitespace/HTML escaping from the URL value first","Fall back to URLEncoding/RawStdEncoding if the site changes schemes","Sample and inspect item.URL values when failures spike"],"tags":["base64","encoding","decryption","parsing","go"],"backgroundTag":"invalid-argument-format","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}