fix: Subinfo parse error

This commit is contained in:
MystiPanda
2023-12-15 11:35:10 +08:00
parent 8955ca5216
commit a719237556
2 changed files with 20 additions and 24 deletions

View File

@@ -247,12 +247,11 @@ impl PrfItem {
let extra = match header.get("Subscription-Userinfo") {
Some(value) => {
let sub_info = value.to_str().unwrap_or("");
Some(PrfExtra {
upload: help::parse_str(sub_info, "upload=").unwrap_or(0),
download: help::parse_str(sub_info, "download=").unwrap_or(0),
total: help::parse_str(sub_info, "total=").unwrap_or(0),
expire: help::parse_str(sub_info, "expire=").unwrap_or(0),
upload: help::parse_str(sub_info, "upload").unwrap_or(0),
download: help::parse_str(sub_info, "download").unwrap_or(0),
total: help::parse_str(sub_info, "total").unwrap_or(0),
expire: help::parse_str(sub_info, "expire").unwrap_or(0),
})
}
None => None,
@@ -262,9 +261,9 @@ impl PrfItem {
let filename = match header.get("Content-Disposition") {
Some(value) => {
let filename = value.to_str().unwrap_or("");
match help::parse_str::<String>(filename, "filename=") {
match help::parse_str::<String>(filename, "filename") {
Some(filename) => Some(filename),
None => match help::parse_str::<String>(filename, "filename*=") {
None => match help::parse_str::<String>(filename, "filename*") {
Some(filename) => {
let iter = percent_encoding::percent_decode(filename.as_bytes());
let filename = iter.decode_utf8().unwrap_or_default();