Skip to content

Commit f792d31

Browse files
committed
Don't require a user in the DSN
1 parent d705216 commit f792d31

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/raven.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ function triggerEvent(eventType, options) {
423423
}
424424

425425
var dsnKeys = 'source protocol user pass host port path'.split(' '),
426-
dsnPattern = /^(?:(\w+):)?\/\/(\w+)(:\w+)?@([\w\.-]+)(?::(\d+))?(\/.*)/;
426+
dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;
427427

428428
function RavenConfigError(message) {
429429
this.name = 'RavenConfigError';

test/raven.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,15 @@ describe('globals', function() {
359359
assert.strictEqual(pieces.host, 'matt-robenolt.com');
360360
});
361361

362+
it('should parse domain without user', function() {
363+
var pieces = parseDSN('http://matt-robenolt.com/1');
364+
assert.strictEqual(pieces.protocol, 'http');
365+
assert.strictEqual(pieces.user, '');
366+
assert.strictEqual(pieces.port, '');
367+
assert.strictEqual(pieces.path, '/1');
368+
assert.strictEqual(pieces.host, 'matt-robenolt.com');
369+
});
370+
362371
it('should raise a RavenConfigError when setting a password', function() {
363372
try {
364373
parseDSN('http://user:[email protected]/2');

0 commit comments

Comments
 (0)