I am building a route to download files from our server. The problem is that the filepath contains forward slashes and then the filePath variable only contains the first folder.
NOTE: Don't worry - the code locks the filepath down to specific folders by checking the first folder to ensure the path begins inside a download directory.
I tried using different delimiters than the normal slash, like a +. The code does actually work if I do this but that's such a terrible hack. Is there any other way to do this?
In other words, this works:
http://localhost:5000/files/C/temp+uploads+upload_c64bc04e02
But this doesn't work:
http://localhost:5000/files/C/temp/uploads/upload_c64bc04e02
I really feel like I should be finding a way to get this to work.
router.get('/files/:bucketCode/:filePath', auth.check, async (req, res) => {
let bucketCode= req.params.bucketCode;
let filePath = req.params.filePath;