File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -187,11 +187,7 @@ ConnectionConfig.parseUrl = function(url) {
187
187
188
188
if ( typeof url . username == 'string' ) {
189
189
options . user = url . username ;
190
- try {
191
- options . password = decodeURIComponent ( url . password ) ;
192
- } catch ( e ) {
193
- options . password = url . password ;
194
- }
190
+ options . password = decodeUriComponent ( url . password ) ;
195
191
} else if ( url . auth ) {
196
192
var auth = url . auth . split ( ':' ) ;
197
193
options . user = auth . shift ( ) ;
@@ -224,3 +220,13 @@ ConnectionConfig.parseUrl = function(url) {
224
220
225
221
return options ;
226
222
} ;
223
+
224
+ function decodeUriComponent ( str ) {
225
+ return str . replace ( / \% ( [ a - f 0 - 9 ] { 2 } ) / ig, function ( _ , hex ) {
226
+ try {
227
+ return String . fromCharCode ( parseInt ( hex , 16 ) ) ;
228
+ } catch ( e ) {
229
+ return _ ;
230
+ }
231
+ } ) ;
232
+ }
You can’t perform that action at this time.
0 commit comments