Skip to content

Commit d96c459

Browse files
committed
Allow hyphens in the domain of a DSN (regression)
Fixes #160
1 parent d5420d6 commit d96c459

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
@@ -323,7 +323,7 @@ function triggerEvent(eventType, options) {
323323
}
324324

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

328328
/**** Private functions ****/
329329
function parseDSN(str) {

test/raven.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ describe('globals', function() {
154154
assert.strictEqual(pieces.path, '/');
155155
assert.strictEqual(pieces.host, 'mattrobenolt.com');
156156
});
157+
158+
it('should parse domain with hyphen', function() {
159+
var pieces = parseDSN('http://[email protected]/1');
160+
assert.strictEqual(pieces.protocol, 'http');
161+
assert.strictEqual(pieces.user, 'user');
162+
assert.strictEqual(pieces.port, '');
163+
assert.strictEqual(pieces.path, '/1');
164+
assert.strictEqual(pieces.host, 'matt-robenolt.com');
165+
});
157166
});
158167

159168
describe('normalizeFrame', function() {

0 commit comments

Comments
 (0)