Skip to content

fix(drivers/pikpak): normalize known OSS upload endpoints - #3187

Open
adsf0427 wants to merge 1 commit into
OpenListTeam:mainfrom
adsf0427:fix/pikpak-upload-endpoint
Open

adsf0427 wants to merge 1 commit into
OpenListTeam:mainfrom
adsf0427:fix/pikpak-upload-endpoint

Conversation

@adsf0427

Copy link
Copy Markdown

Summary / 摘要

PikPak uploads can fail before any file data reaches OSS: an endpoint such as upload-a10b.mypikpak.com becomes vip-lixian-07.upload-a10b.mypikpak.com when the SDK prepends the bucket. Bucket hosts under .mypikpak.net also fail DNS resolution.

Normalize the known PikPak base domains, upload-* gateways, and an optional matching bucket prefix to https://mypikpak.com, allowing the SDK to add the bucket exactly once. Apply this before both simple and multipart uploads, regardless of platform. Preserve unknown domains and URLs with custom ports, credentials, paths, queries, or fragments.

Unlike unconditional first-label stripping in #2862, bare mypikpak.com / mypikpak.net cannot become com / net. The .net case in #2986 is also mapped to the working .com bucket host. Tests cover these regressions, unrelated endpoints, malformed input, and the real OSS SDK's request URLs for two different buckets.

  • This PR has breaking changes.
  • This PR changes public API, config, storage format, or migration behavior.
  • This PR requires corresponding changes in related repositories.

Related repository PRs / 关联仓库 PR: None.

Related Issues / 关联 Issue

Fixes #2986.
Relates to #2431 and #2862.

Testing / 测试

Based on upstream main at 482464c2affc5eeba5d4a25bb272aeb352ec5918, using Go 1.27.1 on Linux amd64.

  • PikPak package tests pass in GOMAXPROCS=2 CGO_ENABLED=0 go test -p 2 -tags=jsoniter ./drivers/pikpak ./internal/net -count=1.
  • GOMAXPROCS=2 CGO_ENABLED=0 go vet -tags=jsoniter ./drivers/pikpak.
  • Full backend build: GOMAXPROCS=2 CGO_ENABLED=0 go build -p 2 -tags=jsoniter -trimpath -o /tmp/openlist-head . (output location shortened here).
  • Automated live validation of this patched HEAD in an isolated server with a real PikPak account, platform=web: fresh random 1 MiB and 16 MiB files exercise ordinary and multipart uploads; both uploads complete, both downloaded files match their original SHA-256, and the test directory is removed afterward.
  • go test ./... was not run.
  • Live Android / PC authentication and uploads were not tested. The regression tests exercise endpoint forms independently of the platform setting.

The combined package test command is not fully green: internal/net fails TestNewOSSClientUsesEnvironmentHTTPSProxy with expected *http.Transport, got *net.safeTransport. The same failure was reproduced in a clean worktree at the unmodified base commit with GOMAXPROCS=2 CGO_ENABLED=0 go test -p 2 -tags=jsoniter ./internal/net -run '^TestNewOSSClientUsesEnvironmentHTTPSProxy$' -count=1.

Checklist / 检查清单

  • I have read CONTRIBUTING.
  • I confirm this contribution follows the repository license, contribution policy, and code of conduct.
  • I have formatted the changed code with gofmt and checked git diff --check.
  • I have requested review from relevant maintainers or code owners where applicable.

AI Disclosure / AI 使用声明

  • This PR includes AI-assisted content.

Tools used / 使用工具:

  • Codex

Usage scope / 使用范围:

  • Code generation / 代码生成

  • Tests / 测试

  • Documentation (PR description) / 文档

  • Review assistance / 审查辅助

  • The AI-assisted content was reviewed and validated by Codex, including the commands and live checks above.

  • All AI-assisted commits include Co-authored-by attribution.

  • Independent human reproduction without AI tools has been completed.

This contribution was prepared and submitted by Codex at the account owner's explicit request. Independent human review or reproduction is not claimed.

- Normalize known PikPak upload gateways and matching bucket hosts to the HTTPS .com OSS base.
- Preserve unrelated domains and custom endpoint URLs instead of stripping arbitrary labels.
- Cover endpoint boundaries and actual OSS SDK URL construction for simple and multipart uploads.

Co-authored-by: Codex <267193182+codex@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] PikPak 上传 no such host:OSS endpoint 落在 .net 侧(无任何 DNS 记录),附取证与已验证修法

1 participant