Fight against the encoding in openstack 17/106917/1
authorSmokowski, Steven <steve.smokowski@att.com>
Thu, 30 Apr 2020 13:58:21 +0000 (09:58 -0400)
committerBenjamin, Max (mb388a) <mb388a@att.com>
Thu, 30 Apr 2020 13:58:21 +0000 (09:58 -0400)
Fight against the encoding in openstack
Fight against the encoding in openstack

Issue-ID: SO-2854
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I239093e28f835a5de480f07b480c5ec3931ccc83

adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java

index 740eb77..687afed 100644 (file)
@@ -74,10 +74,13 @@ public class GlanceClientImpl extends MsoCommonUtils {
             String encodedName = null;
             if (name != null) {
                 try {
-                    encodedName = URLEncoder.encode(name, "UTF-8");
+                    encodedName =
+                            "in:\"" + URLEncoder.encode(name, "UTF-8").replace("+", "%20").replace("%3A", ":") + "\"";
                 } catch (UnsupportedEncodingException e) {
-                    logger.error("error encoding query parameter: {}", encodedName);
+                    logger.error("Error Encoding Image Name", e);
+                    throw new GlanceClientException("Error Endcoding Name", e);
                 }
+
             }
             Glance glanceClient = getGlanceClient(cloudSiteId, tenantId);
             // list is set to false, otherwise an invalid URL is appended