Skip to content

Commit

Permalink
Fix mismatched region argument (when w=3 etc..)
Browse files Browse the repository at this point in the history
  • Loading branch information
lajp committed Nov 16, 2021
1 parent 6ebf865 commit eb331c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

5 changes: 2 additions & 3 deletions src/vahti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,14 @@ fn vahti_to_api(vahti: &str) -> String {
let num = url[index+2..endindex+index].parse::<i32>().unwrap();
if num >= 100 {
region = num-100;
url = url.replace(&url[index..endindex+index], &format!("region={}", region));
} else if url.contains("ca=") {
let nindex = url.find("ca=").unwrap();
let nendindex = url[nindex..].find('&').unwrap_or(url.len()-nindex);
let num = url[nindex+3..nendindex+nindex].parse::<i32>().unwrap();
region = num;
} else {
region = num;
url = url.replace(&url[index..endindex+index], &format!("region={}", region));
}
url = url.replace(&url[index..endindex+index], &format!("region={}", region));
} else {
url = url.replace("ca=", "region=");
}
Expand Down

0 comments on commit eb331c5

Please sign in to comment.