Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to preserve trailing slash on deletes #197

Merged

Conversation

giacomo-alzetta-aiven
Copy link
Contributor

@giacomo-alzetta-aiven giacomo-alzetta-aiven commented Jan 15, 2025

Most object storages support having a slash in the object
name and rohmu should be able to delete such objects.

Let the default behaviour the same but introduce an option
preserve_trailing_slash which allows to control whether the trailing
slash in the key are stripped or not.

About this change - What it does

Resolves: #198

Why this way

Introducing a new flag is backward compatible and preserves the existing behaviour in case this is actually a requirement for some user.

We can later on switch the default value of preserve_trailing_slash to True if we think we want this behaviour by default.

For local/sftp which can't support slashes I opted for explicitly raising an Error if the user passes preserve_trailing_slash=True instead of just ignoring the parameter.

@giacomo-alzetta-aiven giacomo-alzetta-aiven force-pushed the giacomo-alzetta-aiven-fix-delete-of-keys-ending-in-slash branch 6 times, most recently from 8ff4cc0 to eeb0570 Compare January 16, 2025 13:28
@giacomo-alzetta-aiven giacomo-alzetta-aiven changed the title Preserve trailing slash on delete Add option to preserve trailing slash on deletes Jan 16, 2025
@giacomo-alzetta-aiven giacomo-alzetta-aiven force-pushed the giacomo-alzetta-aiven-fix-delete-of-keys-ending-in-slash branch 5 times, most recently from 6d0e3a5 to afed708 Compare January 16, 2025 14:59
Most object storages support having a slash in the object
name and rohmu should be able to delete such objects.

Let the default behaviour the same but introduce an option
`preserve_trailing_slash` which allows to control whether the trailing
slash in the key are stripped or not.

Added test coverage for `delete_key` and `delete_keys` methods for all
transfer types (several had no coverage of it).
@giacomo-alzetta-aiven giacomo-alzetta-aiven force-pushed the giacomo-alzetta-aiven-fix-delete-of-keys-ending-in-slash branch from afed708 to 3f6fb08 Compare January 16, 2025 15:00
@giacomo-alzetta-aiven giacomo-alzetta-aiven marked this pull request as ready for review January 16, 2025 15:05
Copy link
Contributor

@jadkik jadkik left a comment

Choose a reason for hiding this comment

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

LGTM, really minor comment on one of the tests

test/object_storage/test_local.py Show resolved Hide resolved
@bugant bugant merged commit 1d0b29e into main Jan 16, 2025
9 checks passed
@bugant bugant deleted the giacomo-alzetta-aiven-fix-delete-of-keys-ending-in-slash branch January 16, 2025 15:46
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.

Rohmu can't delete objects with a trailing slash
3 participants