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

Repetition Bug #12

Open
joelawm opened this issue Jun 12, 2021 · 0 comments
Open

Repetition Bug #12

joelawm opened this issue Jun 12, 2021 · 0 comments

Comments

@joelawm
Copy link

joelawm commented Jun 12, 2021

Bug Reports

rocket = "0.4.10"

Windows 10 2004

The bug seems to be in the following code
Broken:

 let upload_max: u32 = 10;

let options = MultipartFormDataOptions::with_multipart_form_data_fields(
     vec! [
			MultipartFormDataField::file("URL").
repetition(Repetition::fixed(upload_max))
.content_type_by_string(Some(mime::IMAGE_STAR)).unwrap(),
			MultipartFormDataField::text("body"),
		]
);

Works:

let upload_max: u32 = 3;

let options = MultipartFormDataOptions::with_multipart_form_data_fields(
     vec! [
			MultipartFormDataField::file("URL").
repetition(Repetition::fixed(upload_max))
.content_type_by_string(Some(mime::IMAGE_STAR)).unwrap(),
			MultipartFormDataField::text("body"),
		]
);

If I set the upload max to 3 the code works as expected and will upload the 3 files and finish the routine. If I go to 10 (my desired upload limit) it throws an error stating "The data type of field url is incorrect.".
I looked through the source code a bit to see how the fixed() function works and I don't see anything inherently wrong with it. I also could be using this wrong, but it seems the max for the code was set higher than 10 as well. Any help would be appreciated!

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

No branches or pull requests

1 participant