Open redrockzee opened 8 years ago
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: getRealPath: function(publicPath) { //return Path.join(Util.rtrim(this.basePath, Path.sep), Util.trim(publicPath, Path.sep)); return Path.join(Util.rtrim(this.basePath, '/\'), Util.trim(publicPath, '/\')); },
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: /**