Skip to content

fix(storage): support path-style by s3 force-path-style config#251

Merged
vsxd merged 1 commit intomainfrom
fix/s3-presigner-path-style-config
Apr 10, 2026
Merged

fix(storage): support path-style by s3 force-path-style config#251
vsxd merged 1 commit intomainfrom
fix/s3-presigner-path-style-config

Conversation

@dongmucat
Copy link
Copy Markdown
Collaborator

概述

修复 S3Presigner 未读取 forcePathStyle 配置导致预签名 URL 始终使用 host-style 的问题。

变更内容

后端实现

  • S3StorageService 中抽取 buildPresigner(),统一构建 S3Presigner
  • 为 presigner 增加 S3Configuration.pathStyleAccessEnabled(properties.isForcePathStyle())
  • 保持现有 endpoint/publicEndpoint 选择逻辑不变,确保兼容原有配置

前端实现

测试覆盖

  • 后端单测:新增 S3StorageServiceTest
    • forcePathStyle=true 时断言生成 path-style URL(/bucket/key
    • forcePathStyle=false 时断言生成 host-style URL(bucket.host/key
  • 前端单测:无
  • E2E 测试:无(本次无前端改动)

质量门禁

  • make typecheck-web 通过(0 errors)
  • make lint-web 通过(0 errors, 0 warnings)
  • make test-frontend 通过
  • make test-backend-app 通过(如有后端变更)
  • Playwright E2E(web/e2e)关键路径通过(如有 UI 交互变更)
  • make generate-api 已执行且 schema.d.ts 已提交(如有 Controller 变更)

安全考虑

本次变更不涉及安全敏感内容。

相关 Issue

Closes #248

测试说明

本地验证步骤

  1. 设置 skillhub.storage.provider=s3 并配置 S3/MinIO endpoint 与凭证
  2. 切换 skillhub.storage.s3.force-path-style=true/false
  3. 调用下载预签名 URL 生成流程,检查 URL 形态是否分别为 path-style/host-style

回归测试范围

  • S3 预签名 URL 生成逻辑
  • 现有 endpoint/publicEndpoint 场景

截图/录屏(如有 UI 变更)

@vsxd vsxd merged commit 3e1b573 into main Apr 10, 2026
3 checks passed
@vsxd vsxd deleted the fix/s3-presigner-path-style-config branch April 10, 2026 02:01
Rsweater pushed a commit to Rsweater/skillhub that referenced this pull request Apr 16, 2026
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] S3Presigner 构建时没有设置 forcePathStyle(true),导致生成的预签名 URL 使用的是默认的 host-style

2 participants