55 Commits

Author SHA1 Message Date
renovate 31324eed7a chore(deps): update pre-commit hook golangci/golangci-lint to v2.12.1
renovate/stability-days Updates have met minimum release age requirement
storage / test (pull_request) Successful in 1m32s
storage / vulnerabilities (pull_request) Successful in 1m30s
pre-commit / pre-commit (pull_request) Failing after 6m5s
2026-05-04 16:11:41 +00:00
renovate 88c37a2a77 chore(deps): update pre-commit hook golangci/golangci-lint to v2.12.0 (#110)
storage / vulnerabilities (push) Successful in 1m36s
Release / release (push) Failing after 47s
storage / test (push) Successful in 1m55s
pre-commit / pre-commit (push) Successful in 6m34s
2026-05-04 14:27:49 +00:00
renovate 397627b24b fix(deps): update module github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager to v0.1.20 (#108)
Release / release (push) Successful in 53s
storage / test (push) Successful in 1m34s
storage / vulnerabilities (push) Successful in 1m37s
pre-commit / pre-commit (push) Successful in 5m56s
2026-05-03 19:27:46 +00:00
renovate e93c8069eb chore(deps): update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.25.0 (#106)
storage / vulnerabilities (push) Successful in 1m35s
storage / test (push) Successful in 1m52s
Release / release (push) Successful in 1m2s
pre-commit / pre-commit (push) Successful in 6m1s
2026-05-03 16:52:18 +00:00
renovate 81e393de2a fix(deps): update aws-sdk-go-v2 monorepo (#105)
Release / release (push) Failing after 50s
storage / test (push) Successful in 1m41s
storage / vulnerabilities (push) Successful in 1m40s
pre-commit / pre-commit (push) Successful in 6m16s
2026-05-03 06:56:31 +00:00
renovate fbbe21f911 fix(deps): update aws-sdk-go-v2 monorepo (#104)
Release / release (push) Failing after 46s
storage / test (push) Successful in 1m37s
storage / vulnerabilities (push) Successful in 1m40s
pre-commit / pre-commit (push) Successful in 8m8s
2026-04-25 19:28:04 +00:00
renovate fbf1105c24 fix(deps): update aws-sdk-go-v2 monorepo (#103)
Release / release (push) Failing after 53s
storage / test (push) Successful in 1m40s
storage / vulnerabilities (push) Successful in 1m40s
pre-commit / pre-commit (push) Successful in 6m17s
2026-04-20 20:26:40 +00:00
renovate 46450f8f37 fix(deps): update aws-sdk-go-v2 monorepo (#102)
Release / release (push) Failing after 49s
storage / test (push) Successful in 1m35s
storage / vulnerabilities (push) Successful in 1m36s
pre-commit / pre-commit (push) Successful in 5m51s
2026-04-19 19:28:24 +00:00
releaser a4dedab2f5 chore(release): prepare for v0.4.0 (#100)
Release / release (push) Successful in 46s
storage / test (push) Successful in 1m40s
storage / vulnerabilities (push) Successful in 1m53s
pre-commit / pre-commit (push) Successful in 7m20s
## [0.4.0] - 2026-04-17

### 🚀 Features

- Auto-enable path-style addressing when a custom endpoint is set (#99)

<!-- generated by git-cliff -->

---

**Note:** Please use **Squash Merge** when merging this PR.

Reviewed-on: #100
Co-authored-by: Unbound Releaser <releaser@unbound.se>
Co-committed-by: Unbound Releaser <releaser@unbound.se>
2026-04-17 17:31:17 +00:00
argoyle 1620565ae6 feat: auto-enable path-style addressing when a custom endpoint is set (#99)
Release / release (push) Successful in 52s
storage / test (push) Successful in 1m46s
storage / vulnerabilities (push) Successful in 1m46s
pre-commit / pre-commit (push) Successful in 6m26s
## Summary

When `AWS_ENDPOINT_URL_S3` or `AWS_ENDPOINT_URL` is set — typically because the runtime is pointing at a local MinIO / S3-compatible endpoint — auto-enable path-style addressing on the S3 client. Without this, requests fail because MinIO does not implement virtual-hosted style addressing out of the box.

Production deployments leave those env vars unset and continue talking to real AWS S3 with virtual-hosted style — no behaviour change for prod.

Both `New()` and `NewS3()` share a `s3ClientOptions` helper that applies the toggle.

## Motivation

Spinning up a MinIO-backed acctest environment for Shiny (document-service, invoice-service, accounting-service). Without this change callers would have to sidestep `storage.New` and construct an `aws.Config` by hand just to flip `UsePathStyle`.

## Test plan

- [x] New unit test `TestS3ClientOptions_PathStyleTogglesOnCustomEndpoint` covers the three relevant env-var states
- [x] `go test ./...` passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #99
2026-04-17 17:18:53 +00:00
releaser 7539b5db24 chore(release): prepare for v0.3.0 (#98)
storage / test (push) Successful in 1m36s
Release / release (push) Successful in 1m56s
storage / vulnerabilities (push) Successful in 2m45s
pre-commit / pre-commit (push) Successful in 6m21s
## [0.3.0] - 2026-04-16

### 🚀 Features

- Add PresignInlineURL method for inline content display (#97)

<!-- generated by git-cliff -->

---

**Note:** Please use **Squash Merge** when merging this PR.

Reviewed-on: #98
Co-authored-by: Unbound Releaser <releaser@unbound.se>
Co-committed-by: Unbound Releaser <releaser@unbound.se>
2026-04-16 09:03:25 +00:00
argoyle 862ec3f7bc feat: add PresignInlineURL method for inline content display (#97)
storage / vulnerabilities (push) Successful in 1m43s
storage / test (push) Successful in 1m44s
Release / release (push) Successful in 58s
pre-commit / pre-commit (push) Successful in 6m14s
## Summary

- Add `PresignInlineURL(ctx, key, contentType)` method that generates presigned URLs with `Content-Disposition: inline` and optional `Content-Type` override
- Browsers will render content (e.g. PDFs) directly in iframes instead of triggering download dialogs
- Existing `PresignURL` remains unchanged

## Context

The document-service uses presigned S3 URLs to display PDFs in iframes. Without `Content-Disposition: inline`, the browser triggers a download dialog instead of rendering the PDF.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #97
2026-04-16 08:52:38 +00:00
releaser cdad7f1f66 chore(release): prepare for v0.2.0 (#96)
Release / release (push) Successful in 53s
storage / test (push) Successful in 1m41s
storage / vulnerabilities (push) Successful in 1m54s
pre-commit / pre-commit (push) Successful in 6m10s
## [0.2.0] - 2026-04-16

### 🚀 Features

- Add PresignURL method for existing objects (#95)

### 🐛 Bug Fixes

- *(deps)* Update aws-sdk-go-v2 monorepo (#92)
- *(deps)* Update aws-sdk-go-v2 monorepo (#93)

<!-- generated by git-cliff -->

---

**Note:** Please use **Squash Merge** when merging this PR.

Reviewed-on: #96
Co-authored-by: Unbound Releaser <releaser@unbound.se>
Co-committed-by: Unbound Releaser <releaser@unbound.se>
2026-04-16 06:50:17 +00:00
argoyle 425056b0c2 feat: add PresignURL method for existing objects (#95)
Release / release (push) Successful in 59s
storage / vulnerabilities (push) Successful in 1m43s
storage / test (push) Successful in 1m56s
pre-commit / pre-commit (push) Successful in 5m29s
## Summary

Add `PresignURL(ctx, key)` method to generate presigned download URLs for existing S3 objects (15 min expiry). Needed by document-service to serve document preview/download links.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Reviewed-on: #95
2026-04-16 06:41:56 +00:00
renovate c3eeaddc10 fix(deps): update aws-sdk-go-v2 monorepo (#93)
Release / release (push) Successful in 1m4s
storage / test (push) Successful in 1m36s
storage / vulnerabilities (push) Successful in 1m42s
pre-commit / pre-commit (push) Successful in 6m2s
2026-04-10 19:42:55 +00:00
renovate 78d05388d2 fix(deps): update aws-sdk-go-v2 monorepo (#92)
Release / release (push) Failing after 47s
storage / test (push) Successful in 1m37s
storage / vulnerabilities (push) Successful in 1m45s
pre-commit / pre-commit (push) Successful in 6m18s
2026-04-05 19:29:23 +00:00
releaser b2490bab23 chore(release): prepare for v0.1.4 (#91)
Release / release (push) Successful in 47s
storage / vulnerabilities (push) Successful in 1m39s
storage / test (push) Successful in 1m43s
pre-commit / pre-commit (push) Successful in 6m23s
## [0.1.4] - 2026-03-31

### 🐛 Bug Fixes

- *(deps)* Update module github.com/aws/aws-sdk-go-v2/service/s3 to v1.97.0 (#80)
- *(deps)* Update module github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager to v0.1.9 (#82)
- *(deps)* Update aws-sdk-go-v2 monorepo (#83)
- *(deps)* Update aws-sdk-go-v2 monorepo (#87)
- *(deps)* Update aws-sdk-go-v2 monorepo (#88)
- *(deps)* Update aws-sdk-go-v2 monorepo (#90)

### ⚙️ Miscellaneous Tasks

- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.11.2 (#74)
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.11.3 (#76)
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.30.1 (#78)
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.11.4 (#85)

<!-- generated by git-cliff -->

---

**Note:** Please use **Squash Merge** when merging this PR.

Reviewed-on: #91
Co-authored-by: Unbound Releaser <releaser@unbound.se>
Co-committed-by: Unbound Releaser <releaser@unbound.se>
2026-04-02 09:14:06 +00:00
renovate dd3ff95990 fix(deps): update aws-sdk-go-v2 monorepo (#90)
Release / release (push) Failing after 58s
storage / vulnerabilities (push) Successful in 1m43s
storage / test (push) Successful in 1m44s
pre-commit / pre-commit (push) Successful in 6m19s
2026-03-31 19:19:07 +00:00
renovate 7d1237ee84 fix(deps): update aws-sdk-go-v2 monorepo (#88)
Release / release (push) Successful in 1m26s
storage / test (push) Successful in 1m41s
storage / vulnerabilities (push) Successful in 1m59s
pre-commit / pre-commit (push) Successful in 6m27s
2026-03-26 19:20:13 +00:00
renovate 01d63892b3 fix(deps): update aws-sdk-go-v2 monorepo (#87)
Release / release (push) Failing after 58s
storage / vulnerabilities (push) Successful in 1m49s
storage / test (push) Successful in 2m6s
pre-commit / pre-commit (push) Successful in 6m27s
2026-03-23 19:22:31 +00:00
renovate b24e0b7047 chore(deps): update pre-commit hook golangci/golangci-lint to v2.11.4 (#85)
storage / vulnerabilities (push) Successful in 1m38s
storage / test (push) Successful in 2m4s
Release / release (push) Successful in 55s
pre-commit / pre-commit (push) Successful in 6m17s
2026-03-22 18:46:14 +00:00
renovate 78af8b0e1b fix(deps): update aws-sdk-go-v2 monorepo (#83)
Release / release (push) Successful in 55s
storage / test (push) Successful in 2m3s
storage / vulnerabilities (push) Successful in 2m5s
pre-commit / pre-commit (push) Successful in 6m21s
2026-03-13 20:27:47 +00:00
renovate dd739d2225 fix(deps): update module github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager to v0.1.9 (#82)
storage / test (push) Successful in 1m37s
Release / release (push) Failing after 54s
storage / vulnerabilities (push) Successful in 1m49s
pre-commit / pre-commit (push) Successful in 5m19s
2026-03-12 20:28:18 +00:00
renovate 643f10ba3f fix(deps): update module github.com/aws/aws-sdk-go-v2/service/s3 to v1.97.0 (#80)
Release / release (push) Successful in 1m21s
storage / test (push) Successful in 2m5s
storage / vulnerabilities (push) Successful in 2m17s
pre-commit / pre-commit (push) Successful in 12m14s
2026-03-12 19:40:05 +00:00
renovate f710c631e7 chore(deps): update pre-commit hook gitleaks/gitleaks to v8.30.1 (#78)
Release / release (push) Successful in 1m19s
storage / vulnerabilities (push) Successful in 1m40s
storage / test (push) Successful in 2m31s
pre-commit / pre-commit (push) Successful in 7m24s
2026-03-12 16:28:18 +00:00
renovate 325031b5cf chore(deps): update pre-commit hook golangci/golangci-lint to v2.11.3 (#76)
storage / test (push) Successful in 1m49s
Release / release (push) Successful in 1m18s
storage / vulnerabilities (push) Successful in 1m57s
pre-commit / pre-commit (push) Successful in 13m29s
2026-03-10 11:41:42 +00:00
renovate 5c83764bf2 chore(deps): update pre-commit hook golangci/golangci-lint to v2.11.2 (#74)
Release / release (push) Successful in 1m0s
storage / test (push) Successful in 1m46s
storage / vulnerabilities (push) Successful in 1m37s
pre-commit / pre-commit (push) Successful in 7m5s
2026-03-08 08:39:23 +00:00
releaser 3f760a62e1 chore(release): prepare for v0.1.3 (#73)
Release / release (push) Successful in 1m6s
storage / test (push) Successful in 1m58s
storage / vulnerabilities (push) Successful in 2m19s
pre-commit / pre-commit (push) Successful in 6m4s
## [0.1.3] - 2026-03-06

### 🐛 Bug Fixes

- *(deps)* Update aws-sdk-go-v2 monorepo (#60)
- *(deps)* Update aws-sdk-go-v2 monorepo (#62)
- *(deps)* Update aws-sdk-go-v2 monorepo (#64)
- *(deps)* Update aws-sdk-go-v2 monorepo (#66)
- *(deps)* Update aws-sdk-go-v2 monorepo (#68)
- *(deps)* Update aws-sdk-go-v2 monorepo (#70)

### ⚙️ Miscellaneous Tasks

- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.9.0 (#56)
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.10.1 (#58)
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.11.1 (#72)

<!-- generated by git-cliff -->

---

**Note:** Please use **Squash Merge** when merging this PR.

Reviewed-on: #73
Co-authored-by: Unbound Releaser <releaser@unbound.se>
Co-committed-by: Unbound Releaser <releaser@unbound.se>
2026-03-06 20:00:33 +00:00
renovate 7dae9b02d2 chore(deps): update pre-commit hook golangci/golangci-lint to v2.11.1 (#72)
Release / release (push) Successful in 1m12s
storage / test (push) Successful in 1m47s
storage / vulnerabilities (push) Successful in 2m11s
pre-commit / pre-commit (push) Successful in 6m15s
2026-03-06 16:22:39 +00:00
renovate cd97f212aa fix(deps): update aws-sdk-go-v2 monorepo (#70)
Release / release (push) Successful in 57s
storage / test (push) Successful in 2m6s
storage / vulnerabilities (push) Successful in 2m10s
pre-commit / pre-commit (push) Successful in 5m46s
2026-03-05 21:27:29 +00:00
renovate 986731e9a2 fix(deps): update aws-sdk-go-v2 monorepo (#68)
Release / release (push) Successful in 1m3s
storage / test (push) Successful in 2m4s
storage / vulnerabilities (push) Successful in 2m9s
pre-commit / pre-commit (push) Successful in 6m5s
2026-03-03 22:30:51 +00:00
renovate fc07508d7c fix(deps): update aws-sdk-go-v2 monorepo (#66)
Release / release (push) Successful in 1m1s
storage / vulnerabilities (push) Successful in 1m42s
storage / test (push) Successful in 2m51s
pre-commit / pre-commit (push) Successful in 6m52s
2026-02-26 20:35:21 +00:00
renovate 57a8f9e929 fix(deps): update aws-sdk-go-v2 monorepo (#64)
Release / release (push) Successful in 1m5s
storage / vulnerabilities (push) Successful in 3m20s
storage / test (push) Successful in 3m46s
pre-commit / pre-commit (push) Successful in 6m55s
2026-02-24 05:40:23 +00:00
renovate 1c7b12c348 fix(deps): update aws-sdk-go-v2 monorepo (#62)
Release / release (push) Successful in 1m53s
storage / vulnerabilities (push) Successful in 3m54s
storage / test (push) Successful in 4m22s
pre-commit / pre-commit (push) Successful in 7m17s
2026-02-18 21:19:51 +00:00
renovate 6ef6d9712a fix(deps): update aws-sdk-go-v2 monorepo (#60)
Release / release (push) Successful in 54s
storage / test (push) Successful in 1m49s
storage / vulnerabilities (push) Successful in 1m53s
pre-commit / pre-commit (push) Successful in 6m34s
2026-02-17 22:18:55 +00:00
renovate e324605c3e chore(deps): update pre-commit hook golangci/golangci-lint to v2.10.1 (#58)
storage / vulnerabilities (push) Successful in 1m35s
Release / release (push) Successful in 3m50s
storage / test (push) Successful in 4m48s
pre-commit / pre-commit (push) Successful in 11m37s
2026-02-17 17:55:58 +00:00
renovate 9b0ee6b6ac chore(deps): update pre-commit hook golangci/golangci-lint to v2.9.0 (#56)
Release / release (push) Successful in 1m23s
storage / vulnerabilities (push) Successful in 1m34s
storage / test (push) Successful in 5m9s
pre-commit / pre-commit (push) Successful in 11m39s
2026-02-11 13:58:57 +00:00
argoyle 9ada1c5e17 Merge pull request 'chore(release): prepare for v0.1.2' (#52) from next-release into main
Release / release (push) Successful in 43s
storage / vulnerabilities (push) Successful in 1m46s
storage / test (push) Successful in 1m55s
pre-commit / pre-commit (push) Successful in 4m28s
Reviewed-on: #52
2026-02-06 00:31:05 +00:00
releaser d1f616b9d8 chore(release): prepare for v0.1.2
storage / vulnerabilities (pull_request) Successful in 4m9s
storage / test (pull_request) Successful in 6m53s
pre-commit / pre-commit (pull_request) Successful in 11m38s
2026-02-06 00:13:26 +00:00
releaser 20ca082a98 chore(release): prepare for v0.1.2 2026-02-06 00:13:23 +00:00
releaser b0c84530bc chore(release): prepare for v0.1.2
storage / vulnerabilities (pull_request) Successful in 6m40s
pre-commit / pre-commit (pull_request) Successful in 6m56s
storage / test (pull_request) Successful in 7m18s
2026-02-06 00:11:30 +00:00
releaser b220632f74 chore(release): prepare for v0.1.2 2026-02-06 00:11:30 +00:00
releaser ba064f9ae0 chore(release): prepare for v0.1.2 2026-02-06 00:11:30 +00:00
releaser 0bf774486b chore(release): prepare for v0.1.2 2026-02-06 00:11:30 +00:00
releaser ddadc1e882 chore(release): prepare for v0.1.2 2026-02-06 00:11:30 +00:00
releaser 9bf09d0f8f chore(release): prepare for v0.1.2 2026-02-06 00:11:30 +00:00
releaser 59554f49de chore(release): prepare for v0.1.2 2026-02-06 00:11:30 +00:00
releaser 0a657a499e chore(release): prepare for v0.1.2 2026-02-06 00:11:30 +00:00
argoyle 44a0a6bd36 Merge pull request 'refactor: migrate from deprecated s3/manager to s3/transfermanager' (#55) from migrate-to-transfermanager into main
storage / vulnerabilities (push) Successful in 2m1s
storage / test (push) Successful in 2m56s
Release / release (push) Successful in 1m26s
pre-commit / pre-commit (push) Successful in 8m29s
Reviewed-on: #55
2026-02-06 00:10:15 +00:00
argoyle d8decc411e refactor: migrate from deprecated s3/manager to s3/transfermanager
storage / test (pull_request) Successful in 1m25s
storage / vulnerabilities (pull_request) Successful in 1m58s
pre-commit / pre-commit (pull_request) Successful in 5m0s
Replace feature/s3/manager (deprecated) with feature/s3/transfermanager.
Updates Uploader interface, constructor, and all tests to use the new
UploadObject API with transfermanager types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 01:03:19 +01:00
renovate f260d3c3c0 fix(deps): update module github.com/aws/aws-sdk-go-v2/feature/s3/manager to v1.22.0 (#54)
Release / release (push) Failing after 57s
storage / vulnerabilities (push) Successful in 2m4s
storage / test (push) Successful in 2m28s
pre-commit / pre-commit (push) Failing after 4m5s
2026-02-05 21:21:09 +00:00
renovate dee1809673 fix(deps): update aws-sdk-go-v2 monorepo (#53)
storage / vulnerabilities (push) Successful in 2m14s
Release / release (push) Failing after 4m47s
storage / test (push) Successful in 7m9s
pre-commit / pre-commit (push) Failing after 10m41s
2026-01-28 20:30:57 +00:00
renovate 3c2b55e2cf fix(deps): update module github.com/aws/aws-sdk-go-v2/feature/s3/manager to v1.21.0 (#51)
Release / release (push) Successful in 2m31s
storage / vulnerabilities (push) Successful in 7m10s
storage / test (push) Successful in 7m27s
pre-commit / pre-commit (push) Successful in 10m45s
2026-01-20 21:19:59 +00:00
renovate 734386c3fc chore(deps): update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.24.0 (#50)
Release / release (push) Failing after 2m3s
storage / test (push) Successful in 3m25s
storage / vulnerabilities (push) Successful in 4m47s
pre-commit / pre-commit (push) Successful in 7m25s
2026-01-13 21:33:15 +00:00
renovate cf65c464b8 fix(deps): update aws-sdk-go-v2 monorepo (#49)
Release / release (push) Failing after 57s
storage / vulnerabilities (push) Successful in 8m50s
storage / test (push) Successful in 9m21s
pre-commit / pre-commit (push) Successful in 9m9s
2026-01-09 20:28:17 +00:00
7 changed files with 230 additions and 83 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ repos:
- --allow-multiple-documents
- id: check-added-large-files
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.23.0
rev: v9.25.0
hooks:
- id: commitlint
stages: [ commit-msg ]
@@ -30,10 +30,10 @@ repos:
- id: go-test
- id: gofumpt
- repo: https://github.com/golangci/golangci-lint
rev: v2.8.0
rev: v2.12.1
hooks:
- id: golangci-lint-full
- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.0
rev: v8.30.1
hooks:
- id: gitleaks
+1 -1
View File
@@ -1,3 +1,3 @@
{
"version": "v0.1.1"
"version": "v0.4.0"
}
+75
View File
@@ -2,6 +2,81 @@
All notable changes to this project will be documented in this file.
## [0.4.0] - 2026-04-17
### 🚀 Features
- Auto-enable path-style addressing when a custom endpoint is set (#99)
## [0.3.0] - 2026-04-16
### 🚀 Features
- Add PresignInlineURL method for inline content display (#97)
## [0.2.0] - 2026-04-16
### 🚀 Features
- Add PresignURL method for existing objects (#95)
### 🐛 Bug Fixes
- *(deps)* Update aws-sdk-go-v2 monorepo (#92)
- *(deps)* Update aws-sdk-go-v2 monorepo (#93)
## [0.1.4] - 2026-04-02
### 🐛 Bug Fixes
- *(deps)* Update module github.com/aws/aws-sdk-go-v2/service/s3 to v1.97.0 (#80)
- *(deps)* Update module github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager to v0.1.9 (#82)
- *(deps)* Update aws-sdk-go-v2 monorepo (#83)
- *(deps)* Update aws-sdk-go-v2 monorepo (#87)
- *(deps)* Update aws-sdk-go-v2 monorepo (#88)
- *(deps)* Update aws-sdk-go-v2 monorepo (#90)
### ⚙️ Miscellaneous Tasks
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.11.2 (#74)
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.11.3 (#76)
- *(deps)* Update pre-commit hook gitleaks/gitleaks to v8.30.1 (#78)
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.11.4 (#85)
## [0.1.3] - 2026-03-06
### 🐛 Bug Fixes
- *(deps)* Update aws-sdk-go-v2 monorepo (#60)
- *(deps)* Update aws-sdk-go-v2 monorepo (#62)
- *(deps)* Update aws-sdk-go-v2 monorepo (#64)
- *(deps)* Update aws-sdk-go-v2 monorepo (#66)
- *(deps)* Update aws-sdk-go-v2 monorepo (#68)
- *(deps)* Update aws-sdk-go-v2 monorepo (#70)
### ⚙️ Miscellaneous Tasks
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.9.0 (#56)
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.10.1 (#58)
- *(deps)* Update pre-commit hook golangci/golangci-lint to v2.11.1 (#72)
## [0.1.2] - 2026-02-06
### 🐛 Bug Fixes
- *(deps)* Update aws-sdk-go-v2 monorepo (#49)
- *(deps)* Update module github.com/aws/aws-sdk-go-v2/feature/s3/manager to v1.21.0 (#51)
- *(deps)* Update aws-sdk-go-v2 monorepo (#53)
- *(deps)* Update module github.com/aws/aws-sdk-go-v2/feature/s3/manager to v1.22.0 (#54)
### 🚜 Refactor
- Migrate from deprecated s3/manager to s3/transfermanager
### ⚙️ Miscellaneous Tasks
- *(deps)* Update pre-commit hook alessandrojcm/commitlint-pre-commit-hook to v9.24.0 (#50)
## [0.1.1] - 2026-01-09
### ⚙️ Miscellaneous Tasks
+20 -21
View File
@@ -1,29 +1,28 @@
module gitea.unbound.se/unboundsoftware/storage
go 1.23
go 1.24
require (
github.com/aws/aws-sdk-go-v2 v1.41.0
github.com/aws/aws-sdk-go-v2/config v1.32.6
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18
github.com/aws/aws-sdk-go-v2/service/s3 v1.95.0
github.com/aws/aws-sdk-go-v2 v1.41.7
github.com/aws/aws-sdk-go-v2/config v1.32.17
github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.20
github.com/aws/aws-sdk-go-v2/service/s3 v1.100.1
)
require (
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.6 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.16 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.8 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.41.5 // indirect
github.com/aws/smithy-go v1.24.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.10 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.16 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.15 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.23 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 // indirect
github.com/aws/smithy-go v1.25.1 // indirect
)
+38 -40
View File
@@ -1,40 +1,38 @@
github.com/aws/aws-sdk-go-v2 v1.41.0 h1:tNvqh1s+v0vFYdA1xq0aOJH+Y5cRyZ5upu6roPgPKd4=
github.com/aws/aws-sdk-go-v2 v1.41.0/go.mod h1:MayyLB8y+buD9hZqkCW3kX1AKq07Y5pXxtgB+rRFhz0=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 h1:489krEF9xIGkOaaX3CE/Be2uWjiXrkCH6gUX+bZA/BU=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4/go.mod h1:IOAPF6oT9KCsceNTvvYMNHy0+kMF8akOjeDvPENWxp4=
github.com/aws/aws-sdk-go-v2/config v1.32.6 h1:hFLBGUKjmLAekvi1evLi5hVvFQtSo3GYwi+Bx4lpJf8=
github.com/aws/aws-sdk-go-v2/config v1.32.6/go.mod h1:lcUL/gcd8WyjCrMnxez5OXkO3/rwcNmvfno62tnXNcI=
github.com/aws/aws-sdk-go-v2/credentials v1.19.6 h1:F9vWao2TwjV2MyiyVS+duza0NIRtAslgLUM0vTA1ZaE=
github.com/aws/aws-sdk-go-v2/credentials v1.19.6/go.mod h1:SgHzKjEVsdQr6Opor0ihgWtkWdfRAIwxYzSJ8O85VHY=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16 h1:80+uETIWS1BqjnN9uJ0dBUaETh+P1XwFy5vwHwK5r9k=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.16/go.mod h1:wOOsYuxYuB/7FlnVtzeBYRcjSRtQpAW0hCP7tIULMwo=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18 h1:9vWXHtaepwoAl/UuKzxwgOoJDXPCC3hvgNMfcmdS2Tk=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.18/go.mod h1:sKuUZ+MwUTuJbYvZ8pK0x10LvgcJK3Y4rmh63YBekwk=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16 h1:rgGwPzb82iBYSvHMHXc8h9mRoOUBZIGFgKb9qniaZZc=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.16/go.mod h1:L/UxsGeKpGoIj6DxfhOWHWQ/kGKcd4I1VncE4++IyKA=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16 h1:1jtGzuV7c82xnqOVfx2F0xmJcOw5374L7N6juGW6x6U=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.16/go.mod h1:M2E5OQf+XLe+SZGmmpaI2yy+J326aFf6/+54PoxSANc=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.16 h1:CjMzUs78RDDv4ROu3JnJn/Ig1r6ZD7/T2DXLLRpejic=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.16/go.mod h1:uVW4OLBqbJXSHJYA9svT9BluSvvwbzLQ2Crf6UPzR3c=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 h1:0ryTNEdJbzUCEWkVXEXoqlXV72J5keC1GvILMOuD00E=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4/go.mod h1:HQ4qwNZh32C3CBeO6iJLQlgtMzqeG17ziAA/3KDJFow=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7 h1:DIBqIrJ7hv+e4CmIk2z3pyKT+3B6qVMgRsawHiR3qso=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.7/go.mod h1:vLm00xmBke75UmpNvOcZQ/Q30ZFjbczeLFqGx5urmGo=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16 h1:oHjJHeUy0ImIV0bsrX0X91GkV5nJAyv1l1CC9lnO0TI=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.16/go.mod h1:iRSNGgOYmiYwSCXxXaKb9HfOEj40+oTKn8pTxMlYkRM=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16 h1:NSbvS17MlI2lurYgXnCOLvCFX38sBW4eiVER7+kkgsU=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.16/go.mod h1:SwT8Tmqd4sA6G1qaGdzWCJN99bUmPGHfRwwq3G5Qb+A=
github.com/aws/aws-sdk-go-v2/service/s3 v1.95.0 h1:MIWra+MSq53CFaXXAywB2qg9YvVZifkk6vEGl/1Qor0=
github.com/aws/aws-sdk-go-v2/service/s3 v1.95.0/go.mod h1:79S2BdqCJpScXZA2y+cpZuocWsjGjJINyXnOsf5DTz8=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.4 h1:HpI7aMmJ+mm1wkSHIA2t5EaFFv5EFYXePW30p1EIrbQ=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.4/go.mod h1:C5RdGMYGlfM0gYq/tifqgn4EbyX99V15P2V3R+VHbQU=
github.com/aws/aws-sdk-go-v2/service/sso v1.30.8 h1:aM/Q24rIlS3bRAhTyFurowU8A0SMyGDtEOY/l/s/1Uw=
github.com/aws/aws-sdk-go-v2/service/sso v1.30.8/go.mod h1:+fWt2UHSb4kS7Pu8y+BMBvJF0EWx+4H0hzNwtDNRTrg=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12 h1:AHDr0DaHIAo8c9t1emrzAlVDFp+iMMKnPdYy6XO4MCE=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.12/go.mod h1:GQ73XawFFiWxyWXMHWfhiomvP3tXtdNar/fi8z18sx0=
github.com/aws/aws-sdk-go-v2/service/sts v1.41.5 h1:SciGFVNZ4mHdm7gpD1dgZYnCuVdX1s+lFTg4+4DOy70=
github.com/aws/aws-sdk-go-v2/service/sts v1.41.5/go.mod h1:iW40X4QBmUxdP+fZNOpfmkdMZqsovezbAeO+Ubiv2pk=
github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk=
github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
github.com/aws/aws-sdk-go-v2 v1.41.7 h1:DWpAJt66FmnnaRIOT/8ASTucrvuDPZASqhhLey6tLY8=
github.com/aws/aws-sdk-go-v2 v1.41.7/go.mod h1:4LAfZOPHNVNQEckOACQx60Y8pSRjIkNZQz1w92xpMJc=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.10 h1:gx1AwW1Iyk9Z9dD9F4akX5gnN3QZwUB20GGKH/I+Rho=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.10/go.mod h1:qqY157uZoqm5OXq/amuaBJyC9hgBCBQnsaWnPe905GY=
github.com/aws/aws-sdk-go-v2/config v1.32.17 h1:FpL4/758/diKwqbytU0prpuiu60fgXKUWCpDJtApclU=
github.com/aws/aws-sdk-go-v2/config v1.32.17/go.mod h1:OXqUMzgXytfoF9JaKkhrOYsyh72t9G+MJH8mMRaexOE=
github.com/aws/aws-sdk-go-v2/credentials v1.19.16 h1:r3RJBuU7X9ibt8RHbMjWE6y60QbKBiII6wSrXnapxSU=
github.com/aws/aws-sdk-go-v2/credentials v1.19.16/go.mod h1:6cx7zqDENJDbBIIWX6P8s0h6hqHC8Avbjh9Dseo27ug=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23 h1:UuSfcORqNSz/ey3VPRS8TcVH2Ikf0/sC+Hdj400QI6U=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.23/go.mod h1:+G/OSGiOFnSOkYloKj/9M35s74LgVAdJBSD5lsFfqKg=
github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.20 h1:iEd9YuD/T9SrH/7NoMZ3Jz81OLqVfxOa94XZNqpSE9s=
github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager v0.1.20/go.mod h1:hHSAgymEQbdCmEDXvNxhXiKJxJOWRJi84Gp34anL858=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 h1:GpT/TrnBYuE5gan2cZbTtvP+JlHsutdmlV2YfEyNde0=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23/go.mod h1:xYWD6BS9ywC5bS3sz9Xh04whO/hzK2plt2Zkyrp4JuA=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23 h1:bpd8vxhlQi2r1hiueOw02f/duEPTMK59Q4QMAoTTtTo=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23/go.mod h1:15DfR2nw+CRHIk0tqNyifu3G1YdAOy68RftkhMDDwYk=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24 h1:OQqn11BtaYv1WLUowvcA30MpzIu8Ti4pcLPIIyoKZrA=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.24/go.mod h1:X5ZJyfwVrWA96GzPmUCWFQaEARPR7gCrpq2E92PJwAE=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.9 h1:FLudkZLt5ci0ozzgkVo8BJGwvqNaZbTWb3UcucAateA=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.9/go.mod h1:w7wZ/s9qK7c8g4al+UyoF1Sp/Z45UwMGcqIzLWVQHWk=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.15 h1:ieLCO1JxUWuxTZ1cRd0GAaeX7O6cIxnwk7tc1LsQhC4=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.15/go.mod h1:e3IzZvQ3kAWNykvE0Tr0RDZCMFInMvhku3qNpcIQXhM=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23 h1:pbrxO/kuIwgEsOPLkaHu0O+m4fNgLU8B3vxQ+72jTPw=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.23/go.mod h1:/CMNUqoj46HpS3MNRDEDIwcgEnrtZlKRaHNaHxIFpNA=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.23 h1:03xatSQO4+AM1lTAbnRg5OK528EUg744nW7F73U8DKw=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.23/go.mod h1:M8l3mwgx5ToK7wot2sBBce/ojzgnPzZXUV445gTSyE8=
github.com/aws/aws-sdk-go-v2/service/s3 v1.100.1 h1:mxuT1xE+dI54NW3RkNjP8DUT5HXqbkiAFvfdyDFwE5c=
github.com/aws/aws-sdk-go-v2/service/s3 v1.100.1/go.mod h1:L2dcoOgS2VSgbPLvpak2NyUPsO1TBN7M45Z4H7DlRc4=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.11 h1:TdJ+HdzOBhU8+iVAOGUTU63VXopcumCOF1paFulHWZc=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.11/go.mod h1:R82ZRExE/nheo0N+T8zHPcLRTcH8MGsnR3BiVGX0TwI=
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 h1:7byT8HUWrgoRp6sXjxtZwgOKfhss5fW6SkLBtqzgRoE=
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17/go.mod h1:xNWknVi4Ezm1vg1QsB/5EWpAJURq22uqd38U8qKvOJc=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 h1:+1Kl1zx6bWi4X7cKi3VYh29h8BvsCoHQEQ6ST9X8w7w=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21/go.mod h1:4vIRDq+CJB2xFAXZ+YgGUTiEft7oAQlhIs71xcSeuVg=
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 h1:F/M5Y9I3nwr2IEpshZgh1GeHpOItExNM9L1euNuh/fk=
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1/go.mod h1:mTNxImtovCOEEuD65mKW7DCsL+2gjEH+RPEAexAzAio=
github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI=
github.com/aws/smithy-go v1.25.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
+54 -8
View File
@@ -3,18 +3,32 @@ package storage
import (
"context"
"io"
"os"
"time"
"github.com/aws/aws-sdk-go-v2/aws"
v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
// Uploader is the interface for uploading objects to S3 using the upload manager
// s3ClientOptions returns the per-client overrides applied to every S3 client
// constructed by this package. When the AWS_ENDPOINT_URL_S3 (or
// AWS_ENDPOINT_URL) env var is set — typically because the runtime is
// pointing at a local MinIO/S3-compatible endpoint — path-style addressing
// is enabled so requests look like `http://host:9000/bucket/key` instead of
// `http://bucket.host:9000/key`. Production deployments leave those vars
// unset and continue talking to real S3 with virtual-hosted style.
func s3ClientOptions(o *s3.Options) {
if os.Getenv("AWS_ENDPOINT_URL_S3") != "" || os.Getenv("AWS_ENDPOINT_URL") != "" {
o.UsePathStyle = true
}
}
// Uploader is the interface for uploading objects to S3 using the transfer manager
type Uploader interface {
Upload(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error)
UploadObject(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error)
}
// DirectUploader is the interface for uploading objects directly to S3
@@ -45,7 +59,7 @@ func (s *S3) Store(path string, content io.Reader, contentType string) (string,
}
func (s *S3) storeWithManager(path string, content io.Reader, contentType string) (string, error) {
out, err := s.svc.Upload(context.Background(), &s3.PutObjectInput{
out, err := s.svc.UploadObject(context.Background(), &transfermanager.UploadObjectInput{
Bucket: aws.String(s.bucket),
Key: aws.String(path),
Body: content,
@@ -92,6 +106,38 @@ func (s *S3) storeWithDirectUpload(path string, content io.Reader, contentType s
return req.URL, nil
}
// PresignURL generates a presigned download URL for an existing object.
// The URL is valid for 15 minutes.
func (s *S3) PresignURL(ctx context.Context, key string) (string, error) {
req, err := s.presigner.PresignGetObject(ctx, &s3.GetObjectInput{
Bucket: aws.String(s.bucket),
Key: aws.String(key),
}, s3.WithPresignExpires(15*time.Minute))
if err != nil {
return "", err
}
return req.URL, nil
}
// PresignInlineURL generates a presigned URL that tells the browser to display
// the content inline rather than triggering a download. The URL is valid for
// 15 minutes.
func (s *S3) PresignInlineURL(ctx context.Context, key string, contentType string) (string, error) {
input := &s3.GetObjectInput{
Bucket: aws.String(s.bucket),
Key: aws.String(key),
ResponseContentDisposition: aws.String("inline"),
}
if contentType != "" {
input.ResponseContentType = aws.String(contentType)
}
req, err := s.presigner.PresignGetObject(ctx, input, s3.WithPresignExpires(15*time.Minute))
if err != nil {
return "", err
}
return req.URL, nil
}
// New creates a new S3 storage instance using the upload manager
// This loads AWS config from the default locations and is suitable for most use cases
func New(bucket string) (*S3, error) {
@@ -99,9 +145,9 @@ func New(bucket string) (*S3, error) {
if err != nil {
return nil, err
}
client := s3.NewFromConfig(cfg)
uploader := manager.NewUploader(client, func(u *manager.Uploader) {
u.PartSize = 5 * 1024 * 1024
client := s3.NewFromConfig(cfg, s3ClientOptions)
uploader := transfermanager.New(client, func(o *transfermanager.Options) {
o.PartSizeBytes = 5 * 1024 * 1024
})
presignClient := s3.NewPresignClient(client)
return &S3{
@@ -115,7 +161,7 @@ func New(bucket string) (*S3, error) {
// NewS3 creates a new S3 storage instance using direct PutObject
// This is useful when you want more control over the AWS configuration
func NewS3(cfg aws.Config, bucket string) *S3 {
client := s3.NewFromConfig(cfg)
client := s3.NewFromConfig(cfg, s3ClientOptions)
return &S3{
bucket: bucket,
directSvc: client,
+39 -10
View File
@@ -10,17 +10,17 @@ import (
"github.com/aws/aws-sdk-go-v2/aws"
v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
// Mock implementations for testing
type mockUploader struct {
uploadFunc func(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error)
uploadFunc func(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error)
}
func (m *mockUploader) Upload(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error) {
func (m *mockUploader) UploadObject(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error) {
return m.uploadFunc(ctx, input, opts...)
}
@@ -40,6 +40,35 @@ func (m *mockPresigner) PresignGetObject(ctx context.Context, params *s3.GetObje
return m.presignFunc(ctx, params, optFns...)
}
// Test path-style toggle
func TestS3ClientOptions_PathStyleTogglesOnCustomEndpoint(t *testing.T) {
cases := []struct {
name string
envVar string
value string
expected bool
}{
{name: "no env var → virtual-hosted", envVar: "", expected: false},
{name: "AWS_ENDPOINT_URL_S3 set → path-style", envVar: "AWS_ENDPOINT_URL_S3", value: "http://minio:9000", expected: true},
{name: "AWS_ENDPOINT_URL set → path-style", envVar: "AWS_ENDPOINT_URL", value: "http://minio:9000", expected: true},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
t.Setenv("AWS_ENDPOINT_URL", "")
t.Setenv("AWS_ENDPOINT_URL_S3", "")
if tc.envVar != "" {
t.Setenv(tc.envVar, tc.value)
}
opts := s3.Options{}
s3ClientOptions(&opts)
if opts.UsePathStyle != tc.expected {
t.Fatalf("UsePathStyle = %v, want %v", opts.UsePathStyle, tc.expected)
}
})
}
}
// Test NewS3 constructor
func TestNewS3(t *testing.T) {
@@ -81,7 +110,7 @@ func TestStore_WithUploadManager_Success(t *testing.T) {
expectedURL := "https://s3.amazonaws.com/test-bucket/path/to/file.pdf?presigned=true"
mockUploader := &mockUploader{
uploadFunc: func(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error) {
uploadFunc: func(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error) {
// Verify input parameters
if *input.Bucket != testBucket {
t.Errorf("Expected bucket %s, got %s", testBucket, *input.Bucket)
@@ -99,7 +128,7 @@ func TestStore_WithUploadManager_Success(t *testing.T) {
t.Errorf("Expected content %s, got %s", testContent, string(body))
}
return &manager.UploadOutput{
return &transfermanager.UploadObjectOutput{
Key: aws.String(testPath),
}, nil
},
@@ -149,7 +178,7 @@ func TestStore_WithUploadManager_UploadError(t *testing.T) {
expectedError := errors.New("upload failed")
mockUploader := &mockUploader{
uploadFunc: func(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error) {
uploadFunc: func(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error) {
return nil, expectedError
},
}
@@ -191,8 +220,8 @@ func TestStore_WithUploadManager_PresignError(t *testing.T) {
expectedError := errors.New("presign failed")
mockUploader := &mockUploader{
uploadFunc: func(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error) {
return &manager.UploadOutput{
uploadFunc: func(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error) {
return &transfermanager.UploadObjectOutput{
Key: aws.String(testPath),
}, nil
},
@@ -390,8 +419,8 @@ func TestStore_PresignExpiry(t *testing.T) {
var capturedExpiry time.Duration
mockUploader := &mockUploader{
uploadFunc: func(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error) {
return &manager.UploadOutput{Key: aws.String(testPath)}, nil
uploadFunc: func(ctx context.Context, input *transfermanager.UploadObjectInput, opts ...func(*transfermanager.Options)) (*transfermanager.UploadObjectOutput, error) {
return &transfermanager.UploadObjectOutput{Key: aws.String(testPath)}, nil
},
}