Skip to content

Commit 6f2d0b9

Browse files
committed
Avoid setup archiver problems of SVGs with and without xlink namespace
1 parent dc9caad commit 6f2d0b9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core

plugins/org.eclipse.oomph.setup.core/src/org/eclipse/oomph/setup/internal/core/SetupArchiver.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import java.io.IOException;
5757
import java.io.InputStream;
5858
import java.io.OutputStream;
59+
import java.nio.charset.StandardCharsets;
5960
import java.util.Arrays;
6061
import java.util.Enumeration;
6162
import java.util.HashMap;
@@ -106,7 +107,11 @@ public boolean canHandle(URI uri)
106107
@Override
107108
public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException
108109
{
109-
return super.createInputStream(configurationImages.get(uri), options);
110+
InputStream inputStream = super.createInputStream(configurationImages.get(uri), options);
111+
String content = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
112+
// The calls are randomly returning results with and without the xlink namespace and prefix on the href.
113+
content = content.replace(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"", "").replace("xlink:href", "href"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
114+
return new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8));
110115
}
111116
});
112117

0 commit comments

Comments
 (0)