-
Notifications
You must be signed in to change notification settings - Fork 34
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
allow mkdir(p"s3://path/not/ending/in/slash") #124
base: master
Are you sure you want to change the base?
Conversation
aligning with `Base.mkdir` behavior.
This doesn't really make sense with S3 paths though. For example, you can have an object called |
@rofinn has written the S3Pathing component of this package so I deferred to him. The title vs. code changes are slightly confusing to me, do you mean you want the ability to do:
Without the slash there? If so, I think that's a reasonable change to make since you're calling Otherwise there is a distinction on S3 with objects |
@mattBrzezinski That's what
My disagreement with this is that if there's a distinction then it should probably be applied everywhere rather than special casing specifc functions, where we're just assuming something is a file or directory. We've been burned by things like this in the past and letting folks be lazy about the destinction sometimes, but not others seems like we're asking for trouble. |
This came up while passing Guess it comes down to how closely you want S3 paths to be compatible with non-AWSS3-aware path manipulations, which can probably not be achieved perfectly. In this case though, the caller is clearly trying to make a dir, not a file/object, seems safe to assume they intended to pass in |
Yeah, I think we erred on the side of caution, i.e., strict S3 compatibility, as it's easier to constrain inputs on the user side rather than risk having unexpected behaviour when combining generic functions.
Yeah, I suspect there's a few other cases where we could make that argument though. I'll make an issue to document all the possible cases where we could choose to infer the |
Another case where this comes up: julia> path = S3Path("s3://bucket/prefix/test/");
julia> tmp = mktempdir(path)
ERROR: ArgumentError: S3Path folders must end with '/': s3://bucket/prefix/test/448e28ff-f9c7-4e8d-a20d-17f98c00198a Though looking at the code of |
Hmm, |
I wonder if this package should have a flag for deciding how strictly to follow the S3 conventions? Maybe giving a single warning about dragons when you change it? I know I've been burnt by having directories and objects with the same name, but that should probably be a risk users can decide for themselves. |
Not having this also seems to break Edit: Actually I think this should be fixed in dir = S3Path(bucket, key_without_final_slash)
if FilesPathBase.exists(dir)
...
else
mkdir(dir)
end can throw! Why? Because |
aligning with
Base.mkdir
behavior.