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

B2-64 Throw error in CLI on passing special headers as file info #245

Closed
wants to merge 9 commits into from
Closed

B2-64 Throw error in CLI on passing special headers as file info #245

wants to merge 9 commits into from

Conversation

emnoor-reef
Copy link

No description provided.

In cli v4 passing `--info b2-content-disposition=attachment` will result in an error telling the user to use `--content-disposition` etc.
Add --allow-special-info flag to disable validation of special headers passed to --info
Comment on lines 457 to 459
error_msg = "Use --{} flag instead of passing {} to --info".format(
key.lstrip('b2-'), key
)

Choose a reason for hiding this comment

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

Is there any particular reason why you're preferring .format() over f-string in this instance?
This is not a request for change, just curious.

Copy link
Author

Choose a reason for hiding this comment

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

Calling functions/methods inside a f-string feels weird to me. And the linter was complaining about %-formatting for some reason. I'll recheck anyways.


class CopyFileById(CopyFileByIdV4):
__doc__ = CopyFileByIdV4.__doc__
WARN_SPECIAL_FILE_INFO_HEADERS = True

Choose a reason for hiding this comment

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

I'd prefer something like ERROR_ON_HEADERS_AS_FILE_INFO = False (not necessarily this exact naming) because WARN_SPECIAL_FILE_INFO_HEADERS might make it sound like in case of False, there's just gonna be no warning, it's an allowed behavior. Whereas what happens is a stronger limitation - an error.

@vbaltrusaitis-reef
Copy link

Just to double-check - while this looks good to me, this PR is not intended to be merged until changes in the SDK (or here?) adds expires, contentDisposition etc properties in the top-level of file object, right?

Renamed `WARN_SPECIAL_FILE_INFO_HEADERS` -> `ERROR_ON_HEADERS_AS_FILE_INFO`
and flipped the meaning
From `--allow-special-info` to `--allow-headers-in-info`
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.

2 participants