File tree 2 files changed +26
-1
lines changed
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -1391,7 +1391,7 @@ Raven.prototype = {
1391
1391
data = objectMerge ( { } , crumb . data ) ;
1392
1392
for ( var j = 0 ; j < urlProps . length ; ++ j ) {
1393
1393
urlProp = urlProps [ j ] ;
1394
- if ( data . hasOwnProperty ( urlProp ) ) {
1394
+ if ( data . hasOwnProperty ( urlProp ) && data [ urlProp ] ) {
1395
1395
data [ urlProp ] = truncate ( data [ urlProp ] , this . _globalOptions . maxUrlLength ) ;
1396
1396
}
1397
1397
}
Original file line number Diff line number Diff line change @@ -1398,6 +1398,31 @@ describe('globals', function() {
1398
1398
} ) ;
1399
1399
} ) ;
1400
1400
1401
+ it ( 'should not throw error when url in breadcrumb is undefined' , function ( ) {
1402
+ this . sinon . stub ( Raven , 'isSetup' ) . returns ( true ) ;
1403
+ this . sinon . stub ( Raven , '_makeRequest' ) ;
1404
+ this . sinon . stub ( Raven , '_getHttpData' ) . returns ( {
1405
+ url : 'http://localhost/?a=b' ,
1406
+ headers : { 'User-Agent' : 'lolbrowser' }
1407
+ } ) ;
1408
+
1409
+ Raven . _globalProject = '2' ;
1410
+ Raven . _globalOptions = {
1411
+ logger : 'javascript' ,
1412
+ maxMessageLength : 100
1413
+ } ;
1414
+ Raven . _globalOptions . maxUrlLength = 35 ;
1415
+
1416
+ var obj = { method : 'POST' , url : undefined } ;
1417
+ // Do not freeze crumb data
1418
+
1419
+ Raven . _breadcrumbs = [ { type : 'request' , timestamp : 0.1 , data : obj } ] ;
1420
+
1421
+ assert . doesNotThrow ( function ( ) {
1422
+ Raven . _send ( { message : 'bar' } ) ;
1423
+ } , TypeError )
1424
+ } ) ;
1425
+
1401
1426
} ) ;
1402
1427
1403
1428
describe ( 'makeRequest' , function ( ) {
You can’t perform that action at this time.
0 commit comments