mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Decode URI
This commit is contained in:
parent
bbbf42b685
commit
62a0e3fbc9
1 changed files with 2 additions and 2 deletions
|
@ -52,7 +52,7 @@ app.use(bodyParser.json({
|
||||||
// app, '/*.mp4', 'video/mp4', 'stuff/video'
|
// app, '/*.mp4', 'video/mp4', 'stuff/video'
|
||||||
function appGetFileType (app, wildcard, contentType, pageToRender) {
|
function appGetFileType (app, wildcard, contentType, pageToRender) {
|
||||||
app.get(wildcard, function (req, res) {
|
app.get(wildcard, function (req, res) {
|
||||||
let p = req.url.replace(/%20/g, ' ')
|
let p = decodeURI(req.url)
|
||||||
let fp = p
|
let fp = p
|
||||||
if (p.includes('?')) {
|
if (p.includes('?')) {
|
||||||
fp = p.split('?')
|
fp = p.split('?')
|
||||||
|
@ -131,7 +131,7 @@ fileTypes.forEach((t) => {
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/*', function (req, res) {
|
app.get('/*', function (req, res) {
|
||||||
let parsedUrl = req.url.replace(/%20/g, ' ')
|
let parsedUrl = decodeURI(req.url)
|
||||||
let curr = listedFiles + '/' + parsedUrl.substring('/'.length, parsedUrl.length).split('?')[0]
|
let curr = listedFiles + '/' + parsedUrl.substring('/'.length, parsedUrl.length).split('?')[0]
|
||||||
let relPath = curr.substring('./public/files'.length, curr.length)
|
let relPath = curr.substring('./public/files'.length, curr.length)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue