Skip to content

fix(obs): 修复选择华为obs作为对象存储并配置proxyDomain参数时校验出错的bug - #2790

Open
CodeMarker0 wants to merge 1 commit into
Tencent:mainfrom
CodeMarker0:fix_obs
Open

fix(obs): 修复选择华为obs作为对象存储并配置proxyDomain参数时校验出错的bug#2790
CodeMarker0 wants to merge 1 commit into
Tencent:mainfrom
CodeMarker0:fix_obs

Conversation

@CodeMarker0

@CodeMarker0 CodeMarker0 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

When Huawei OBS is configured with OBS_PROXY_DOMAIN, upload and copy operations currently return the proxy URL as the file's physical path. The resource registry determines the storage provider from that physical path, so an HTTP(S) proxy URL cannot be reliably identified as an OBS object. This can cause resource registration, later reads, and multi-backend routing to fail.

This PR separates the internal physical path from the externally accessible URL:

  • OBS physical paths are consistently stored as obs://<bucket>/<objectKey>.
  • OBS_PROXY_DOMAIN is used only when generating an accessible URL through GetFileURL.
  • Existing proxy URLs matching the currently configured OBS_PROXY_DOMAIN remain readable and copyable.
  • Bare object keys remain supported for compatibility with existing internal callers.
  • Cross-backend copy attempts and OBS paths belonging to another bucket are rejected.

No database migration is required. Newly uploaded or copied objects use the canonical obs:// representation, while supported legacy paths continue to be resolved at read time.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Refactor
  • ⚡ Performance improvement
  • 🧪 Test
  • 🔧 Configuration / Build / CI

Related Issue

No linked issue. This PR fixes the OBS upload and resource-registration failure reproduced when OBS_PROXY_DOMAIN is configured.

Testing

Added regression coverage for:

  • SaveBytes returning a canonical obs://<bucket>/<objectKey> path when a proxy domain is configured
  • parsing canonical OBS paths, current-domain legacy proxy URLs, and bare object keys
  • rejecting OBS paths belonging to another bucket
  • generating proxy URLs from canonical OBS paths
  • recognizing OBS-owned paths while rejecting other storage providers
  • copying canonical and legacy OBS paths while rejecting cross-backend sources
  • registering and resolving storage://<backend-id>/obs://... resource paths

Automated checks:

  • Go lint passed
  • Format, vet, test, and build passed
  • Tencent open-source security scan passed with no critical security findings

Checklist

  • git diff --check origin/main...HEAD passes
  • Changed source files are formatted
  • Targeted tests for the changed packages/components pass
  • Diff-scoped lint passes where applicable
  • Full-repository format, vet, test, and build checks pass
  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation — N/A: no user-facing configuration, API, or deployment procedure changed
  • Breaking changes are clearly called out — N/A: canonical paths are introduced with compatibility handling for existing supported path formats

Screenshots / Recordings

N/A — no user-visible UI changes.

@CodeMarker0 CodeMarker0 changed the title 修复选择华为obs作为对象存储并配置proxyDomain参数时校验出错的bug fix(obs): 修复选择华为obs作为对象存储并配置proxyDomain参数时校验出错的bug Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

补充合入信息:

  • 当前 PR 无合并冲突,GitHub 显示为 clean / mergeable;
  • Go lint、format、vet、test、build 及开源安全扫描均已通过;
  • 新写入的物理路径统一为 obs://<bucket>/<objectKey>OBS_PROXY_DOMAIN 仅用于生成访问 URL;
  • 兼容与当前代理域名匹配的存量代理 URL,以及裸 object key;
  • 已覆盖上传、路径解析、URL 生成、文件复制、跨后端拒绝及资源注册场景;
  • 不涉及配置格式、API 或部署方式变化,因此无需文档更新或数据迁移。

PR 创建后主分支已有后续提交;如维护流程要求基于最新 main 重新验证,我可以同步分支并再次运行 CI。烦请维护者协助 review。

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.

1 participant