fix: scientific counting matching error

This commit is contained in:
Dnomd343 2024-01-20 13:16:11 +08:00
parent b3de7a4bc5
commit 8682f14ee7

View File

@ -88,13 +88,13 @@ export async function getFlowHeaders(rawUrl, ua, timeout) {
export function parseFlowHeaders(flowHeaders) {
if (!flowHeaders) return;
// unit is KB
const uploadMatch = flowHeaders.match(/upload=(-?)(\d+)/);
const uploadMatch = flowHeaders.match(/upload=(-?)([E+.\d]+)/);
const upload = Number(uploadMatch[1] + uploadMatch[2]);
const downloadMatch = flowHeaders.match(/download=(-?)(\d+)/);
const downloadMatch = flowHeaders.match(/download=(-?)([E+.\d]+)/);
const download = Number(downloadMatch[1] + downloadMatch[2]);
const total = Number(flowHeaders.match(/total=(\d+)/)[1]);
const total = Number(flowHeaders.match(/total=([E+.\d]+)/)[1]);
// optional expire timestamp
const match = flowHeaders.match(/expire=(\d+)/);