Replace path "\" with "/" server-side

This commit is contained in:
valadaptive
2023-12-05 17:55:52 -05:00
parent 795ca2247b
commit 39d771cc4a
5 changed files with 7 additions and 6 deletions

View File

@@ -23,7 +23,7 @@ router.post('/upload', jsonParser, async (request, response) => {
const pathToUpload = path.join(DIRECTORIES.files, request.body.name);
writeFileSyncAtomic(pathToUpload, request.body.data, 'base64');
const url = path.normalize(pathToUpload.replace('public' + path.sep, ''));
const url = path.normalize(pathToUpload.replace('public' + path.sep, '').replace(/\\/g, '/'));
return response.send({ path: url });
} catch (error) {
console.log(error);