mirror of
https://github.com/redstrate/Physis.git
synced 2025-05-10 12:27:45 +00:00
Fix patch length parsing, add tests for it
I don't know how this ever worked, but this was broken. I added checks for it in the patchlist parsing so it doesn't break again.
This commit is contained in:
parent
5efa3c9663
commit
da094ea261
1 changed files with 3 additions and 1 deletions
|
@ -54,7 +54,7 @@ impl PatchList {
|
||||||
|
|
||||||
let mut patch_length = 0;
|
let mut patch_length = 0;
|
||||||
if let Some(patch_length_index) = encoded.find("X-Patch-Length: ") {
|
if let Some(patch_length_index) = encoded.find("X-Patch-Length: ") {
|
||||||
let rest_of_string = &encoded[patch_length_index..];
|
let rest_of_string = &encoded[patch_length_index + 16..];
|
||||||
if let Some(end_of_number_index) = rest_of_string.find("\r\n") {
|
if let Some(end_of_number_index) = rest_of_string.find("\r\n") {
|
||||||
let patch_length_parse: Result<u64, _> =
|
let patch_length_parse: Result<u64, _> =
|
||||||
rest_of_string[0..end_of_number_index].parse();
|
rest_of_string[0..end_of_number_index].parse();
|
||||||
|
@ -193,6 +193,7 @@ mod tests {
|
||||||
"http://patch-dl.ffxiv.com/boot/2b5cbc63/D2023.09.14.0000.0001.patch"
|
"http://patch-dl.ffxiv.com/boot/2b5cbc63/D2023.09.14.0000.0001.patch"
|
||||||
);
|
);
|
||||||
assert_eq!(patch_list.patches[0].size_on_disk, 69674819);
|
assert_eq!(patch_list.patches[0].size_on_disk, 69674819);
|
||||||
|
assert_eq!(patch_list.patch_length, 22221335);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -260,6 +261,7 @@ mod tests {
|
||||||
"http://patch-dl.ffxiv.com/game/ex1/6b936f08/D2023.07.26.0000.0001.patch"
|
"http://patch-dl.ffxiv.com/game/ex1/6b936f08/D2023.07.26.0000.0001.patch"
|
||||||
);
|
);
|
||||||
assert_eq!(patch_list.patches[5].size_on_disk, 5854598228);
|
assert_eq!(patch_list.patches[5].size_on_disk, 5854598228);
|
||||||
|
assert_eq!(patch_list.patch_length, 1664916486);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Add table
Reference in a new issue