File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
var qs = require ( 'qs' ) ;
2
2
var url = require ( 'url' ) ;
3
3
var crypto = require ( 'crypto' ) ;
4
- var debug = require ( 'debug' ) ( "qs:signature" )
4
+ var clone = require ( 'clone' ) ;
5
+ var debug = require ( 'debug' ) ( "qs:signature" ) ;
6
+
7
+ exports . stringify = function ( opts , urlOrPath ) {
8
+ if ( ! opts || ! opts . signature || ! urlOrPath )
9
+ return qs . stringify ( opts ) ;
10
+
11
+ debug ( "signature base64 key" , opts . signature ) ;
12
+ //in order to avoid messing with the key stored by reference, extend:
13
+ var options = clone ( opts ) ;
5
14
6
- exports . stringify = function ( options , urlOrPath ) {
7
- if ( ! options || ! options . signature || ! urlOrPath )
8
- return qs . stringify ( options ) ;
9
15
debug ( "original url/path" , urlOrPath ) ;
10
16
11
17
var usablePrivateKey = new Buffer ( websafe ( options . signature ) , 'base64' ) ;
Original file line number Diff line number Diff line change 18
18
"author" : " Florian Traverse" ,
19
19
"license" : " MIT" ,
20
20
"dependencies" : {
21
+ "clone" : " ^0.1.18" ,
21
22
"debug" : " ^2.1.0" ,
22
23
"qs" : " ^2.3.3"
23
24
},
You can’t perform that action at this time.
0 commit comments