diff --git a/src-tauri/src/config/prfitem.rs b/src-tauri/src/config/prfitem.rs index 7475cf1f..46c86478 100644 --- a/src-tauri/src/config/prfitem.rs +++ b/src-tauri/src/config/prfitem.rs @@ -297,18 +297,27 @@ impl PrfItem { let header = resp.headers(); // parse the Subscription UserInfo - 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), - }) + let extra; + 'extra: { + for (k, v) in header.iter() { + let key_lower = k.as_str().to_ascii_lowercase(); + // Accept standard custom-metadata prefixes (x-amz-meta-, x-obs-meta-, x-cos-meta-, etc.). + if key_lower + .strip_suffix("subscription-userinfo") + .is_some_and(|prefix| prefix.is_empty() || prefix.ends_with('-')) + { + let sub_info = v.to_str().unwrap_or(""); + extra = 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), + }); + break 'extra; + } } - None => None, - }; + extra = None; + } // parse the Content-Disposition let filename = match header.get("Content-Disposition") {