🐞 fix(subscriptions): negative usage flow (#175)

This commit is contained in:
QuentinHsu
2022-10-25 00:07:23 +08:00
committed by GitHub
parent 06d0c14abc
commit 5de35c7720
2 changed files with 7 additions and 3 deletions

View File

@@ -66,8 +66,12 @@ async function getFlowInfo(req, res) {
}
// unit is KB
const upload = Number(flowHeaders.match(/upload=(\d+)/)[1]);
const download = Number(flowHeaders.match(/download=(\d+)/)[1]);
const uploadMatch = flowHeaders.match(/upload=(-?)(\d+)/)
const upload = Number(uploadMatch[1] + uploadMatch[2]);
const downloadMatch = flowHeaders.match(/download=(-?)(\d+)/)
const download = Number(downloadMatch[1] + downloadMatch[2]);
const total = Number(flowHeaders.match(/total=(\d+)/)[1]);
// optional expire timestamp