Skip to content

fix(sync): panic on s3 URI with query string#1974

Merged
toddbaert merged 2 commits into
mainfrom
fix/s3-sync-source-uri-panic
May 29, 2026
Merged

fix(sync): panic on s3 URI with query string#1974
toddbaert merged 2 commits into
mainfrom
fix/s3-sync-source-uri-panic

Conversation

@toddbaert
Copy link
Copy Markdown
Member

@toddbaert toddbaert commented May 29, 2026

#1971 put the query string on the bucket URL (so gocloud reads it), but blob.Sync still emits Source as Bucket + Object, so it no longer matches the registered URI and Store.Update panics.

Pulled the split/join into internal/bloburi and rebuild the URI when emitting DataSync.Source so that things stay consistent if there's changes here - added a test for that as well to lock them as inverses.

Verified manually/locally against MinIO.

Closes #1973

FYI @mvanhorn

@toddbaert toddbaert requested review from a team as code owners May 29, 2026 17:52
@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit 1c8b259
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/6a19d825cb6e530007074757

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 29, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new internal package 'bloburi' to centralize and simplify the parsing and reconstruction of blob sync URIs (such as S3, GCS, and Azure Blob). It refactors 'blob_sync.go' and 'syncbuilder.go' to use the new 'Split' and 'Join' helpers, ensuring query parameters are correctly preserved. Unit tests are also added to verify this behavior. The review feedback suggests adding a nil check for 'schemeRegex' and validating that 'bucket' is not empty in 'Split' to prevent potential nil pointer dereferences and handle invalid URIs gracefully.

Comment thread core/pkg/sync/internal/bloburi/bloburi.go
@toddbaert toddbaert force-pushed the fix/s3-sync-source-uri-panic branch from d9cf105 to a3c3657 Compare May 29, 2026 17:59
Verified locally against MinIO.

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@toddbaert toddbaert force-pushed the fix/s3-sync-source-uri-panic branch from a3c3657 to 0d6a5ee Compare May 29, 2026 18:01
@toddbaert toddbaert requested review from beeme1mr and erka May 29, 2026 18:03
@@ -0,0 +1,32 @@
// Package bloburi splits and rejoins blob sync URIs (s3://, gs://, azblob://).
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extracted these because they need to be inverses of each-other for the logic to work. I've added tests that ensure that as well.

So flagd picks up the core fix from #1973 in the next release.

Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@erka erka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well done @toddbaert !

@toddbaert toddbaert merged commit 82040ff into main May 29, 2026
17 checks passed
@github-actions github-actions Bot mentioned this pull request May 29, 2026
toddbaert pushed a commit that referenced this pull request May 29, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>flagd: 0.15.7</summary>

##
[0.15.7](flagd/v0.15.6...flagd/v0.15.7)
(2026-05-29)


### 🐛 Bug Fixes

* **sync:** panic on s3 URI with query string
([#1974](#1974))
([82040ff](82040ff))
</details>

<details><summary>core: 0.15.8</summary>

##
[0.15.8](core/v0.15.7...core/v0.15.8)
(2026-05-29)


### 🐛 Bug Fixes

* **sync:** panic on s3 URI with query string
([#1974](#1974))
([82040ff](82040ff))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

S3 sync URI with query string panics on Update

3 participants