From d5a3c1e1ef16f1233673a86c514836acc341d5ee Mon Sep 17 00:00:00 2001 From: Yvan Lussaud Date: Wed, 21 Aug 2024 16:56:46 +0200 Subject: [PATCH] Added support for absolute path in HTML services. --- .../m2doc/html/services/M2DocHTMLParser.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/org.obeonetwork.m2doc.html/src/org/obeonetwork/m2doc/html/services/M2DocHTMLParser.java b/plugins/org.obeonetwork.m2doc.html/src/org/obeonetwork/m2doc/html/services/M2DocHTMLParser.java index 3bceeb859..9299a028c 100644 --- a/plugins/org.obeonetwork.m2doc.html/src/org/obeonetwork/m2doc/html/services/M2DocHTMLParser.java +++ b/plugins/org.obeonetwork.m2doc.html/src/org/obeonetwork/m2doc/html/services/M2DocHTMLParser.java @@ -13,6 +13,7 @@ import java.awt.Color; import java.io.BufferedInputStream; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -1685,7 +1686,16 @@ private int getRelativeSize(String imageSize) { * @return the converted URI */ private URI toURI(URI baseURI, String uri) { - return URI.createURI(uri.replace('\\', '/')).resolve(baseURI); + final URI res; + + final File file = new File(uri); + if (file.isAbsolute()) { + res = URI.createFileURI(uri); + } else { + res = URI.createURI(uri.replace('\\', '/')).resolve(baseURI); + } + + return res; } /**