]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph/src/org/simantics/graph/representation/TransferableGraphUtils.java
Escape/unescape names of the externals when converting to/from URIs
[simantics/platform.git] / bundles / org.simantics.graph / src / org / simantics / graph / representation / TransferableGraphUtils.java
index 10637ad65caf0d861d52e3d1adfffdee66d5f2ca..b0690532b85d584969526609181ba6fc712b5ba5 100644 (file)
@@ -70,7 +70,7 @@ public class TransferableGraphUtils {
         if("http:/".equals(uri)) return identity;
         String[] tokens = uri.substring("http://".length()).split("/");
         for(String token : tokens) {
-            identity = findExternalWithNameAndParent(tg, identity.resource, token);
+            identity = findExternalWithNameAndParent(tg, identity.resource, URIStringUtils.unescape(token));
             if (identity == null) {
                 return null;
             }
@@ -301,14 +301,14 @@ public class TransferableGraphUtils {
                 if(definition instanceof External) {
                     External def = (External)definition;
                     if(def.parent == -1) return "http:/";
-                    else return getURI(identities, def.parent) + "/" + def.name;
+                    else return getURI(identities, def.parent) + "/" + URIStringUtils.escape(def.name);
                 } else if(definition instanceof Root) {
                     Root def = (Root)definition;
                     if(def.name.isEmpty()) return "http:/";
                     return def.name;
                 } else if (definition instanceof Internal) {
                     Internal def = (Internal)definition;
-                    return getURI(identities, def.parent) + "/" + def.name;
+                    return getURI(identities, def.parent) + "/" + URIStringUtils.escape(def.name);
                 } else {
                     return "";
                 }