-
Notifications
You must be signed in to change notification settings - Fork 9
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
Header args #221
Header args #221
Conversation
before reading into the thing: |
b2/console_tool.py
Outdated
@@ -1053,6 +1053,31 @@ def _setup_parser(cls, parser): | |||
parser.add_argument('--metadataDirective', default=None, help=argparse.SUPPRESS) | |||
parser.add_argument('--contentType') | |||
parser.add_argument('--range', type=parse_range) | |||
parser.add_argument( |
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.
maybe this requirement has to discussed again, but we wanted passing both these arguments and their --info b2- counterparts should yield a warning, making it clear which value is used (the direct, non --info one)
and even though sdk does logger.warn
in that case, I believe this warning will not propagate to CLI users unless they use non default logging settings. Besides, I think CLI should not rely on that happening, and explicit check will not go to waste, and the warning will be replaced by an error in v4. let me know what you think.
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, you're right, it should emit a warning in CLI if info in file_info
and explicit args differs. Will add.
I do have a case to make against making this an error or forcing to use explicit arguments instead of file_info
: these pieces of information as part of file_info
dictionary is pretty deeply embedded into B2 - it's in the UI, it's in the API, and here the CLI also actually returns the file_info
as returned by B2. If someone does some bash processing with jq
, it seems pretty reasonable to, say, just copy the file_info
from some result and pass that with file_info
, expecting it to work.
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.
I see your points, let's discuss this, this is important stuff
b2/console_tool.py
Outdated
help= | ||
"optional Content-Language header, value based on RFC 2616 section 14.12, example: 'mi, en'" | ||
) | ||
parser.add_argument( |
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.
I know it's just 5 arguments, but maybe their declaration should be made common between this command and line 2923?
More like "sync wasn't mentioned in the ticket or the GitHub issue and I didn't think of it". But use-case and design for these flags for
I'm not saying that |
maybe let's leave it for a separate PR then, if at all. This definitely warrants a disccusion, as the new |
if file_info is not None and key in file_info and file_info[key] != value: | ||
overwritten.append(key) | ||
|
||
if overwritten: |
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.
this is great stuff!
LGTM, ok to merge after adapting to new CHANGELOG flow |
Adds
--expires
,--content-disposition
,--content-encoding
,--content-language
options to subcommandsupload-file
,upload-unbound-stream
,copy-file-by-id
.It used as-of-yet unreleased b2sdk version, hence the draft PR.