File tree 2 files changed +17
-1
lines changed
plugin/expon/src/main/java/org/zstack/expon
test/src/test/groovy/org/zstack/test/integration/storage/primary/addon 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 52
52
import org .zstack .utils .path .PathUtil ;
53
53
import org .zstack .vhost .kvm .VhostVolumeTO ;
54
54
55
+ import java .io .UnsupportedEncodingException ;
55
56
import java .net .URI ;
57
+ import java .net .URLDecoder ;
56
58
import java .util .*;
57
59
import java .util .concurrent .TimeUnit ;
58
60
import java .util .stream .Collectors ;
@@ -122,7 +124,11 @@ public ExponStorageController(String url) {
122
124
123
125
AccountInfo accountInfo = new AccountInfo ();
124
126
accountInfo .username = uri .getUserInfo ().split (":" )[0 ];
125
- accountInfo .password = uri .getUserInfo ().split (":" )[1 ];
127
+ try {
128
+ accountInfo .password = URLDecoder .decode (uri .getUserInfo ().split (":" )[1 ], "utf-8" );
129
+ } catch (UnsupportedEncodingException e ) {
130
+ throw new RuntimeException (e );
131
+ }
126
132
127
133
apiHelper = new ExponApiHelper (accountInfo , client );
128
134
}
Original file line number Diff line number Diff line change @@ -187,6 +187,7 @@ class ExternalPrimaryStorageCase extends SubCase {
187
187
KVMGlobalConfig . VM_SYNC_ON_HOST_PING . updateValue(true )
188
188
simulatorEnv()
189
189
testCreateExponStorage()
190
+ testComplexPassword()
190
191
testSessionExpired()
191
192
testCreateVm()
192
193
testHandleInactiveVolume()
@@ -299,6 +300,15 @@ class ExternalPrimaryStorageCase extends SubCase {
299
300
}
300
301
}
301
302
303
+ void testComplexPassword () {
304
+ String pswd = " Pswd@#123"
305
+ String encodePswd = URLEncoder . encode(pswd, " UTF-8" )
306
+ discoverExternalPrimaryStorage {
307
+ url
= String . format(
" https://complex:%[email protected] :443/pool" , encodePswd)
308
+ identity = " expon"
309
+ }
310
+ }
311
+
302
312
void testSessionExpired () {
303
313
controller. apiHelper. sessionId = " invalid"
304
314
}
You can’t perform that action at this time.
0 commit comments