-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unterminated character class #153
Comments
I fixed this by replacing this function so that it trims both / and \ rather than just using Path.sep. Path.sep contains \ on Windows and is not escaped properly for regular expressions in rtrim(). In tree.js: |
Fix for Issue mikedeboer#153 "Unterminated character class"
This is my file server startup.
:
var jsDAV = require("jsDAV");
jsDAV.debugMode = true;
var jsDAV_Locks_Backend_FS = require("jsDAV/lib/DAV/plugins/locks/fs");
jsDAV.createServer({
node: "./webdav",
locksBackend: jsDAV_Locks_Backend_FS.new("./webdav")
}, 8889);
I get this error when performing a GET on a docx file on Windows. Is the Windows path the problem?
[error] [SyntaxError: Invalid regular expression: /[]+$/: Unterminated character class]
SyntaxError: Invalid regular expression: /[]+$/: Unterminated character class
at new RegExp (native)
at Object.exports.rtrim (c:\devel\dov\node_modules\jsDAV\lib\shared\util.js:114:14)
at Object.module.exports.jsDAV_Tree.extend.getRealPath (c:\devel\dov\node_modules\jsDAV\lib\DAV\backends\fs\tree.js:62:31)
at Object.module.exports.jsDAV_Tree.extend.getNodeForPath (c:\devel\dov\node_modules\jsDAV\lib\DAV\backends\fs\tree.js:41:29)
at __dirname.getNodeForPath (c:\devel\dov\node_modules\jsDAV\lib\DAV\handler.js:328:26)
at __dirname.getAllowedMethods (c:\devel\dov\node_modules\jsDAV\lib\DAV\handler.js:1199:14)
at __dirname.httpOptions (c:\devel\dov\node_modules\jsDAV\lib\DAV\handler.js:374:14)
at c:\devel\dov\node_modules\jsDAV\lib\DAV\handler.js:250:81
at c:\devel\dov\node_modules\jsDAV\lib\shared\asyncEvents.js:82:13
at handler (c:\devel\dov\node_modules\asyncjs\lib\async.js:371:33)
This code throws the error:
/**
exports.rtrim = function(str, charlist) {
charlist = !charlist ? " \s\u00A0" : (charlist+"").replace(/([.?/_{}+$^:])/g, "$1");
var re = new RegExp("[" + charlist + "]+$", "g");
return (str+"").replace(re, "");
};
The text was updated successfully, but these errors were encountered: