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

Bug in non strict mode #70

Open
wbcat opened this issue Nov 2, 2022 · 0 comments
Open

Bug in non strict mode #70

wbcat opened this issue Nov 2, 2022 · 0 comments

Comments

@wbcat
Copy link

wbcat commented Nov 2, 2022

I get panics in some of the examples.
Maybe this is because of max_depth being 0?

// Rust 1.64, serde_qs 0.10.1, Debian 11, x86_64
#![allow(unused)]
#[derive(Debug, Default, serde::Serialize, serde::Deserialize)]
#[serde(default)]
struct Form {
	id: i64,
	name: String,
	vec: Vec<String>,
}

fn main() {
	//  works correct
	let s = "id=2";
	let s = "name=test";
	let s = "id=3&name=&vec%5B1%5D=Vector";

	// runs, but does not fill the struct correct
	let s = "vec[0]=Vector";
	let s = "vec%5B1%5D=Vector";

	// panics
	let s = "name=&vec%5B1%5D=Vector";
	let s = "name=&vec[0]c=Vector";
	let s = "name=test&vec[0]c=Vector";

	let c = serde_qs::Config::new(0, false);
	let f: Form = c.deserialize_str(s).unwrap();
	dbg!(f);
}
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