I am building a web application in NodeJS with Express, Angular JS and Google App-Engine Datastore.
I am learning Node. I created a form that "sanitizes" (escapes) user input before inserting into the database. I followed the NodeJS tutorial on the MDN website to create this code:
//Trim and escape all inputs
req.sanitize('requester').escape();
req.sanitize('requester').trim();
req.sanitize('dataowner').escape();
req.sanitize('dataowner').trim();
req.sanitize('requested_filepath_list').escape();
req.sanitize('requested_filepath_list').trim();
The 'requested_filepath_list' is a list of UNIX file paths.
So when a user submits the request, it is stored in the database in the "Escaped" format.
//Escaped data
/top/example/test123.txt
Question: How can I "unescape" the data for display purposes?
//Desired output
/top/example/test123.txt
I tried the unescape function but it does not seem to work, it just returns the same output.
let escape_str = '/top/example/test123.txt';
let unescaped_str = unescape(escape_str);
console.log('unescaped_str: ' + unescaped_str);
//Output
unescaped_str: /top/example/test123.txt
//Desired output
/top/example/test123.txt