-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
password support to ZipFS #361
base: master
Are you sure you want to change the base?
Conversation
I'm afraid the changed signature is a deal breaker. There is an So the base method could be:
That would allow ZipFS to use a per-file password, while keeping the same signature. There would need to be a similar change to Sorry this may be a large change that it appeared.
FS urls support parameters which you could use to pass in the password. |
I'm a little bit confusing. Just to be checked - there's two things I could do:
But what about Thanks for your kindly reply. |
👍
👍
If a signature changes, it needs to be changed everywhere. i.e. the base, ZipFS and the other built in filesystems. One of the goals of PyFilesystem is that you can swap one filesystem for another, and your code will still work. The base and other filesystems can ignore the password, so it would just be a null-op for them. On reflection, the argument should probably be called |
It's possibly worth doing that in a separate PR, and once that's merged, then come back to this password-protected-zip PR? 🤷♂️ |
Did you mean "dictionary key" rather than "argument" ? |
Yeah, nice to have one feature per PR.
The options are collected kwargs, so I guess that would make it an argument in the call and a dictionary key in the method. |
Ahh, I'd missed that you were using |
def _password_type_check(password): | ||
if isinstance(password, six.binary_type): | ||
return | ||
raise TypeError("except bytes for password, not " + type(password).__name__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar nit: "Accept" not "Except"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe it was a typo of "expect bytes..." ? 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it's typo 😆 i'd like to type 'expect'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe it was a typo of "expect bytes..." ?
That never occurred to me hahaha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it should ultimately say 'Expected', I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would make more sense than my suggestion.
Still waiting for #362 merge before I continue on this branch... |
Type of changes
Checklist
Description
Related issue: #360
This PR add
passwd
argument forZipFS
andReadZipFS
constructor to set the default password for extracting the file. And for per-file password, there is alsopasswd
arg onopenbin
andreadbytes
to override the default settings.Extra, I added
setpassword
onReadZipFS
since users could get the fs fromopen_fs
and there would be no place the set password.One thing to be mention, it changes
readbytes
's signature:and thus it does not follow the form on the base class.
Please let me know if you have any concern.