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

content-disposition header case sensitivity #1540

Closed
wants to merge 4 commits into from

Conversation

MrSagarShah
Copy link
Contributor

@MrSagarShah MrSagarShah commented Aug 9, 2022

New Pull Request Checklist

  • I have read the Documentation
  • I have searched for a similar pull request in the project and found none
  • I have updated this branch with the latest develop to avoid conflicts (via merge from master or rebase)
  • I have added the required tests to prove the fix/feature I am adding
  • I have updated the documentation (if necessary)
  • I have run the tests and they pass

This merge request fixes / refers to the following issues: ...

Pull Request Description

...

@AlexV525
Copy link
Member

According to RFC 6266, it should always be Content-Disposition, so can we just use the camel-cased version?

@MrSagarShah
Copy link
Contributor Author

Ideally yes, I would suggest keeping it flexible.

@@ -30,6 +30,7 @@ class FormData {
/// Whether [finalize] has been called.
bool get isFinalized => _isFinalized;
bool _isFinalized = false;
bool camelCaseContentDisposition = false;
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to be a final field, and initialize it from constructors.

@@ -41,6 +42,11 @@ class FormData {
ListFormat collectionFormat = ListFormat.multi,
]) {
_init();

if (map.containsKey("camelCaseContentDisposition")) {
Copy link
Member

Choose a reason for hiding this comment

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

Using an argument might be better.

@MrSagarShah
Copy link
Contributor Author

Update the PR,
Kept it as optional argument
Please have a look and let me know if anything needs to be updated.
Thanks

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

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

I don't think your recent changes to the code can pass static analysis. Though I'll try to merge this into the fork without extra steps from your side.


FormData() {
FormData({bool camelCaseContentDisposition = false}) {
_camelCaseContentDisposition = camelCaseContentDisposition;
Copy link
Member

Choose a reason for hiding this comment

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

This is invalid since _camelCaseContentDisposition is final.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

ListFormat collectionFormat = ListFormat.multi,
{bool camelCaseContentDisposition = false}
Copy link
Member

Choose a reason for hiding this comment

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

This is impossible when positioned optional arguments are set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, my mistake

- kept the param in the map for now
@AlexV525
Copy link
Member

Hi @MrSagarShah. We've made our hardfork repo public and published a new version of dio, named diox.
The new package contains the PR of the fix.
Please refer to https://pub.dev/packages/diox/versions/5.0.0-dev.1 to use the fork.
You can also see why we're working for a hardfork at cfug/diox#29 and #1607.

@MrSagarShah
Copy link
Contributor Author

@AlexV525 Thanks, Mate.
https://github.com/cfug/diox have more secure ways.
Will try it out.

@AlexV525 AlexV525 closed this Feb 13, 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 this pull request may close these issues.

2 participants