mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CloudStackPrimaryDataStoreLifeCycleImpl: decode path as UTF8 or fallback
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> (cherry picked from commit 6ddaef7a489603b058d360280fc7c4d5ec367346) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
d4663df7c9
commit
fabab5460c
@ -18,8 +18,10 @@
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.lifecycle;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -182,7 +184,14 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore
|
||||
|
||||
String scheme = uri.getScheme();
|
||||
String storageHost = uri.getHost();
|
||||
String hostPath = uri.getPath();
|
||||
String hostPath = null;
|
||||
try {
|
||||
hostPath = URLDecoder.decode(uri.getPath(), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
}
|
||||
if (hostPath == null) { // if decoding fails, use getPath() anyway
|
||||
hostPath = uri.getPath();
|
||||
}
|
||||
Object localStorage = dsInfos.get("localStorage");
|
||||
if (localStorage != null) {
|
||||
hostPath = hostPath.replaceFirst("/", "");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user