fix: "internal server error" on malformed URLs #592
Massimo Melina committed
May 14, 2024 at 22:48 UTC
5a24dda67b0adb6a0593baa293c43bc7d3e71248
1 file changed
+2
-2
src/api.monitor.ts
+2
-2
@@ -2,7 +2,7 @@
2
3
import _ from 'lodash'
4
import { Connection, getConnections } from './connections'
5
-import { shortenAgent, wait } from './misc'
5
+import { shortenAgent, try_, wait } from './misc'
6
import { ApiHandlers } from './apiMiddleware'
7
import Koa from 'koa'
8
import { totalGot, totalInSpeed, totalOutSpeed, totalSent } from './throttler'
@@ -71,7 +71,7 @@ export default {
71
: s.uploadPath ? { op: 'upload',path: decodeURIComponent(s.uploadPath) }
72
: {
73
op: !s.considerAsGui && s.op || undefined,
74
- path: decodeURIComponent(ctx.originalUrl)
74
+ path: try_(() => decodeURIComponent(ctx.originalUrl), () => ctx.originalUrl),
75
},
76
opProgress: _.isNumber(s.opProgress) ? _.round(s.opProgress, 3) : undefined,
77
opTotal: s.opTotal,