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

Normalize '.' and '..' in paths #382

Closed
2 tasks done
ennoruijters opened this issue Sep 29, 2021 · 1 comment · Fixed by #383
Closed
2 tasks done

Normalize '.' and '..' in paths #382

ennoruijters opened this issue Sep 29, 2021 · 1 comment · Fixed by #383
Milestone

Comments

@ennoruijters
Copy link
Contributor

ennoruijters commented Sep 29, 2021

Task Description

S3Path.normalize() currently just returns the path unmodified. This is inconvenient for users wanting to use S3FS as a replacement for more unix-like filesystem, where elements '.' and '..' have special meanings ('this directory', and 'parent directory').

We can make S3FS behave more unix-like by having normalize() effectively remove "./" and "<dir>/../".

Notes

  • S3 itself does not attach special meaning to these filenames, so it is perfectly legal to create an object with key "/abc/../file" distinct from "/file". If we add normalization, we would make such objects inaccessible. If this is particularly unwanted, we could make the behaviour configurable.
  • Paths.get().normalize() on Windows also treats the .. the same way.

Tasks

The following tasks will need to be carried out:

  • Implement S3Path.normalize() that normalizes paths as if they were Unix paths.
  • Include unit tests.

Help

@carlspring
Copy link
Owner

@ennoruijters : Thank you very much for your contribution and apologies for the amount of time it took to get to it!

@carlspring carlspring added this to the 1.0.3 milestone Jul 29, 2023
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 a pull request may close this issue.

2 participants