Skip to content
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

Invalid regular expression #63

Open
alexrazv opened this issue Mar 24, 2013 · 5 comments
Open

Invalid regular expression #63

alexrazv opened this issue Mar 24, 2013 · 5 comments
Assignees

Comments

@alexrazv
Copy link

Hi,

The exception occures when I invoke a function from Client

The screenshot:
http://screencast.com/t/YIRjMVi20jiS

The text:

C:!Hg\timetracker\node_modules\dbox\lib\helpers.js:25
var rx = RegExp("^" + scopePath, "i")
^
SyntaxError: Invalid regular expression: /^/: \ at end of pattern
at new RegExp (unknown source)
at RegExp (unknown source)
at Object.module.exports.parseJSON (C:!Hg\timetracker\node_modules\dbox\lib\helpers.js:25:16)
at Request.exports.app.client.account as _callback
at Request.init.self.callback (C:!Hg\timetracker\node_modules\dbox\node_modules\request\main.js:119:22)
at Request. (C:!Hg\timetracker\node_modules\dbox\node_modules\request\main.js:525:16)
at Request.EventEmitter.emit (events.js:96:17)
at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (C:!Hg\timetracker\node_modules\dbox\node_modules\request\main.js:484:14
)
at IncomingMessage.EventEmitter.emit (events.js:126:20)
at IncomingMessage._emitEnd (http.js:366:10)
DEBUG: Program node app.js exited with code 1

@ghost ghost assigned sintaxi Mar 25, 2013
@sintaxi
Copy link
Owner

sintaxi commented Mar 25, 2013

Thanks for opening the ticket.

@JeffreyVest
Copy link

It's another issue with path.join and urls. On windows machines, it doesn't work. There are multiple places in the code where this is an issue when running on windows.

@Baskerville42
Copy link

Windows 8.1, Node 0.10.30
I try run this code
var dbox = require('dbox');

var app = dbox.app({ "app_key": "key", "app_secret": "secret" });
var client = app.client({ oauth_token_secret: 'oauth_token_secret', oauth_token: 'oauth_token', uid: 'uid' });
client.account(function(status, reply){
console.log(reply)
});

and see next
c:\Users\Alexander\SkyDrive\Projects\toprovidepr-backup\node_modules\dbox\lib\helpers.js:23
var rx = RegExp("^" + scopePath, "i")
^
SyntaxError: Invalid regular expression: /^/: \ at end of pattern
at new RegExp ()
at RegExp ()
at Object.parseJSON (c:\Users\Alexander\SkyDrive\Projects\toprovidepr-backup\node_modules\dbox\lib\helpers.js:23:16)
at Request._callback (c:\Users\Alexander\SkyDrive\Projects\toprovidepr-backup\node_modules\dbox\lib\dbox.js:61:60)
at Request.self.callback (c:\Users\Alexander\SkyDrive\Projects\toprovidepr-backup\node_modules\dbox\node_modules\request\main.js:119:22)
at Request. (c:\Users\Alexander\SkyDrive\Projects\toprovidepr-backup\node_modules\dbox\node_modules\request\main.js:525:16)
at Request.emit (events.js:95:17)
at IncomingMessage. (c:\Users\Alexander\SkyDrive\Projects\toprovidepr-backup\node_modules\dbox\node_modules\request\main.js:484:14)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:938:16

Process finished with exit code 8

When I run this code on linux machine all works good.

@arash-sadr
Copy link

Hello guys,

No body managed to fix this issue? any updates? ;)

The fix I did for myself is replacing the "" with "/"... as below in helper.js line 22 to 24

22 var sPath = path.join("/", scope)
23 var scopePath = sPath.replace("", "/")
24 var rx = RegExp("^" + scopePath, "i")

Cheers

@ashfaq-unstoppable
Copy link

replace this in helper.js
var scopePath = path.join("/", scope)
to
var scopePath = path.join("/", scope).replace("\", "/");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants