Skip to content

fix(s3): ignore prefixes with repeating delimiters#59597

Merged
leftybournes merged 1 commit intomasterfrom
fix/s3_repeating_delimiter
Apr 22, 2026
Merged

fix(s3): ignore prefixes with repeating delimiters#59597
leftybournes merged 1 commit intomasterfrom
fix/s3_repeating_delimiter

Conversation

@leftybournes
Copy link
Copy Markdown
Member

@leftybournes leftybournes commented Apr 13, 2026

  • Resolves: #

Summary

Amazon's hosted S3 service allows repeating delimiters in keys (e.g. 'path/to//file.txt' or 'path/to///file.txt') and we get repeating directories in the filecache as a result (based on the previous examples we get 'path/to/to/file.txt' or 'path/to/to/to/file.txt'). This ignores it and its contents for S3 external storage.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@leftybournes leftybournes added this to the Nextcloud 34 milestone Apr 13, 2026
@leftybournes leftybournes requested a review from a team as a code owner April 13, 2026 04:19
@leftybournes leftybournes requested review from ArtificialOwl, artonge, icewind1991 and salmart-dev and removed request for a team April 13, 2026 04:19
@Rello
Copy link
Copy Markdown
Contributor

Rello commented Apr 14, 2026

please backport to 31 also

// sub folders
if (is_array($result['CommonPrefixes'])) {
foreach ($result['CommonPrefixes'] as $prefix) {
if (preg_match('/\/{2,}$/', $prefix['Prefix'])) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I trust that it works, but I don't get it.

  1. Where are those repeated / coming from? From the NC config or from Amazon?
  2. Do I understand it correctly that this is ignoring repeated / coming from Amazon response?

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.

  1. It's coming from Amazon.
  2. Yes, that's right. It's ignoring it but anything after it is also ignored as a result.

@leftybournes leftybournes requested a review from artonge April 22, 2026 07:22
Signed-off-by: Kent Delante <kent@delante.me>

Amazon's hosted S3 service allows repeating delimiters in keys
(e.g. 'path/to//file.txt' or 'path/to///file.txt') and we get
repeating directories in the filecache as a result (based on the
previous examples we get 'path/to/to/file.txt' or
'path/to/to/to/file.txt'). This ignores it and its contents for S3 external storage.
@leftybournes leftybournes force-pushed the fix/s3_repeating_delimiter branch from a2be017 to 6ce657f Compare April 22, 2026 08:13
@leftybournes leftybournes changed the title fix(s3): handle repeating delimiters fix(s3): ignore prefixes with repeating delimiters Apr 22, 2026
@artonge artonge added the pending documentation This pull request needs an associated documentation update label Apr 22, 2026
Copy link
Copy Markdown
Collaborator

@artonge artonge left a comment

Choose a reason for hiding this comment

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

We need to document that path containing // will be ignored to prevent conflicts, else all good.

@leftybournes leftybournes enabled auto-merge April 22, 2026 08:54
@leftybournes leftybournes disabled auto-merge April 22, 2026 08:55
@leftybournes leftybournes enabled auto-merge April 22, 2026 08:55
@leftybournes
Copy link
Copy Markdown
Member Author

Documentation added here: nextcloud/documentation#14499

@leftybournes
Copy link
Copy Markdown
Member Author

/backport to stable33

@leftybournes
Copy link
Copy Markdown
Member Author

/backport to stable32

@leftybournes
Copy link
Copy Markdown
Member Author

/backport to stable31

@leftybournes leftybournes merged commit fdfcc00 into master Apr 22, 2026
244 of 250 checks passed
@leftybournes leftybournes deleted the fix/s3_repeating_delimiter branch April 22, 2026 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug feature: external storage feature: object storage pending documentation This pull request needs an associated documentation update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants