psf-bch-api 7.3.1 → 7.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/server.js +6 -6
- package/package.json +1 -1
package/bin/server.js
CHANGED
|
@@ -76,13 +76,13 @@ class Server {
|
|
|
76
76
|
|
|
77
77
|
// URL normalization middleware - collapse multiple slashes
|
|
78
78
|
app.use((req, res, next) => {
|
|
79
|
-
if (req.
|
|
79
|
+
if (req.url && req.url.includes('//')) {
|
|
80
|
+
// Split URL into path and query string
|
|
81
|
+
const [path, queryString] = req.url.split('?')
|
|
80
82
|
// Collapse multiple consecutive slashes into a single slash
|
|
81
|
-
const normalizedPath =
|
|
82
|
-
// Reconstruct req.url with normalized path
|
|
83
|
-
|
|
84
|
-
req.url = normalizedPath + queryString
|
|
85
|
-
req.path = normalizedPath
|
|
83
|
+
const normalizedPath = path.replace(/\/+/g, '/')
|
|
84
|
+
// Reconstruct req.url with normalized path (req.path is read-only and will auto-update)
|
|
85
|
+
req.url = queryString ? `${normalizedPath}?${queryString}` : normalizedPath
|
|
86
86
|
}
|
|
87
87
|
next()
|
|
88
88
|
})
|