Skip to content

Commit

Permalink
use serde_qs loose parsing on custom fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishrock123 committed Jun 28, 2022
1 parent 06f9bb4 commit 3c74599
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ http-types = "2.7.0"
log = "0.4.11"
md5 = "0.7.0"
serde_json = "1.0"
serde_qs = "0.9.2"
serde_qs = { version = "0.9.2", "git" = "https://github.com/Fishrock123/serde_qs.git", branch = "feat-percent-decode-lossily" }

[dependencies.async-std]
version = "1.7"
Expand Down
6 changes: 4 additions & 2 deletions src/ipn_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ pub async fn ipn_handler(mut req: AppRequest) -> tide::Result<Response> {
));
}

let serde_qs_loose = serde_qs::Config::new(5, false);

// Check just the `txn_type` of the IPN message.
let txn_type = match serde_qs::from_str::<IPNMessageTypeOnly>(&ipn_transaction_message_raw) {
let txn_type = match serde_qs_loose.deserialize_str::<IPNMessageTypeOnly>(&ipn_transaction_message_raw) {
Ok(msg) => msg.txn_type,
Err(error) => {
return Err(tide::Error::from_str(
Expand Down Expand Up @@ -122,7 +124,7 @@ pub async fn ipn_handler(mut req: AppRequest) -> tide::Result<Response> {

// Attempt to deserialize the IPN message.
let ipn_transaction_message: IPNTransationMessage =
match serde_qs::from_str(&ipn_transaction_message_raw) {
match serde_qs_loose.deserialize_str(&ipn_transaction_message_raw) {
Ok(msg) => msg,
Err(error) => {
return Err(tide::Error::from_str(
Expand Down

0 comments on commit 3c74599

Please sign in to comment.