sanitizeFN

This commit is contained in:
v 2019-02-05 14:09:43 +03:00
parent fed510120a
commit 719a3f9fb3

View File

@ -69,10 +69,10 @@ let http // http request
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247 // https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247
// just in case https://www.mediawiki.org/wiki/Manual:Page_title // just in case https://www.mediawiki.org/wiki/Manual:Page_title
const sanitizeRE = /(?:[\x00-\x1F<>:"\\\?\*]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f])|(?:[. ]$))+/g let sanitizeRE = /(?:[\x00-\x1F<>:"~\\\?\*]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f])|(?:[. ]$))+/g
function sanitizeFN ( name ) { // after https://github.com/pillarjs/encodeurl function sanitizeFN ( name ) { // after https://github.com/pillarjs/encodeurl
return String( name ).replace( sanitizeRE, encodeURIComponent ) return String( name ).replace( sanitizeRE, encodeURIComponent ).replace( /%/g, '~' )
//~ return sanitizeFilename( name, { replacement: '.' }) //~ return sanitizeFilename( name, { replacement: '.' })
} }