Commit bcf83efa authored by Piotr Gawron's avatar Piotr Gawron
Browse files

properly handle uris

parent 5c6c0aba
Pipeline #26533 passed with stage
in 11 minutes and 7 seconds
...@@ -3,6 +3,8 @@ minerva (14.0.12) stable; urgency=medium ...@@ -3,6 +3,8 @@ minerva (14.0.12) stable; urgency=medium
* Bug fix: removing comment from submap did not work * Bug fix: removing comment from submap did not work
* Bug fix: reaction name containing "<" character was exported inproperly to * Bug fix: reaction name containing "<" character was exported inproperly to
CellDesigner (#1227) CellDesigner (#1227)
* Bug fix: doi annotation was inproperly parsed from CellDesigner file and
resulted in not clickable link (#1231)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 11 May 2020 17:00:00 +0200 -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 11 May 2020 17:00:00 +0200
......
package lcsb.mapviewer.model.map; package lcsb.mapviewer.model.map;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -911,7 +913,13 @@ public enum MiriamType { ...@@ -911,7 +913,13 @@ public enum MiriamType {
if (!foundUri.endsWith("/")) { // add one character for separator if (!foundUri.endsWith("/")) { // add one character for separator
uriLength++; uriLength++;
} }
return new MiriamData(foundType, miriamUri.substring(uriLength)); String resource = miriamUri.substring(uriLength);
try {
resource = URLDecoder.decode(resource, "UTF-8");
} catch (UnsupportedEncodingException e) {
logger.warn("Problematic uri: " + resource, e);
}
return new MiriamData(foundType, resource);
} }
throw new InvalidArgumentException("Invalid miriam uri: " + miriamUri); throw new InvalidArgumentException("Invalid miriam uri: " + miriamUri);
} }
......
...@@ -117,4 +117,11 @@ public class MiriamTypeTest extends ModelTestFunctions { ...@@ -117,4 +117,11 @@ public class MiriamTypeTest extends ModelTestFunctions {
} }
} }
@Test
public void testGetMiriamForDoiUri() {
MiriamData md = MiriamType.getMiriamByUri("urn:miriam:doi:10.1109%2F5.771073");
logger.debug(md);
assertTrue(md.getResource().contains("/"));
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment