Decode domain in did:web method.

This commit is contained in:
Xavi Aracil 2023-09-28 08:01:52 +02:00
parent f6b1dff7d8
commit 2b0fd49957

View File

@ -2,6 +2,7 @@ package org.oneedtech.inspect.vc.probe;
import java.io.StringReader; import java.io.StringReader;
import java.net.URI; import java.net.URI;
import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.List; import java.util.List;
@ -111,7 +112,7 @@ public class EmbeddedProofProbe extends Probe<VerifiableCredential> {
methodSpecificId = methodSpecificId.replaceAll(":", "/"); methodSpecificId = methodSpecificId.replaceAll(":", "/");
// 2. If the domain contains a port percent decode the colon. // 2. If the domain contains a port percent decode the colon.
String portPercentEncoded = URLEncoder.encode(":", Charset.forName("UTF-8")); String portPercentEncoded = URLDecoder.decode(":", Charset.forName("UTF-8"));
int index = methodSpecificId.indexOf(portPercentEncoded); int index = methodSpecificId.indexOf(portPercentEncoded);
if (index >= 0 && index < methodSpecificId.indexOf("/")) { if (index >= 0 && index < methodSpecificId.indexOf("/")) {
methodSpecificId = methodSpecificId.replace(portPercentEncoded, ":"); methodSpecificId = methodSpecificId.replace(portPercentEncoded, ":");