Skip to content

fix(files_external/S3): normalize paths in touch()#58703

Draft
joshtrichards wants to merge 5 commits intomasterfrom
jtr/refactor-external-s3-touch
Draft

fix(files_external/S3): normalize paths in touch()#58703
joshtrichards wants to merge 5 commits intomasterfrom
jtr/refactor-external-s3-touch

Conversation

@joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented Mar 3, 2026

  • Resolves: #

Summary

  • Normalizes the incoming path up front, ensuring consistent key derivation and cache invalidation for edge-case paths (leading/trailing slashes, root-like values).
    • The existence check called here already does this internally already, but others (i.e. cleanKey()) do not. Doing it upfront is more consistent with the rest of the class and avoids weird Key values.
  • Clarifies the intended behavior via comments with regard to mtime handling at this layer:
    • For existing objects we return false to let View::touch() emulate mtime updates in our filecache without performing a remote S3 operation
    • For create-if-missing the resulting cached mtime reflects S3’s LastModified rather than any caller-provided $mtime (since custom lastmodified metadata isn’t currently used even though we store it here).
  • Some minor changes to improve code clarity

TODO

  • ...

Checklist

AI (if applicable)

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

- Earlier return and clearer intent.
- $this->file_exists() never throws S3Exception so was pointless.
- Also added comment about what's really going on since returning false seemed wrong here at first


Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
This parameter is only used for copyObject not putObject.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added bug feature: external storage feature: object storage ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) hotspot: file time handling ctime, mtime, etc. handling during various operations labels Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug feature: external storage feature: object storage hotspot: file time handling ctime, mtime, etc. handling during various operations ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant