CloudStackPrimaryDataStoreLifeCycleImpl: decode path as UTF8 or fallback Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6ddaef7a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6ddaef7a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6ddaef7a Branch: refs/heads/4.5 Commit: 6ddaef7a489603b058d360280fc7c4d5ec367346 Parents: 01cc1b8 Author: Rohit Yadav <rohit.ya...@shapeblue.com> Authored: Thu Feb 5 15:27:45 2015 +0530 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Thu Feb 5 15:27:45 2015 +0530 ---------------------------------------------------------------------- .../CloudStackPrimaryDataStoreLifeCycleImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ddaef7a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java ---------------------------------------------------------------------- diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java index ae0d21b..d11342c 100644 --- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java +++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java @@ -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("/", "");