Skip to content
Snippets Groups Projects
Commit fb0f2d2c authored by Lars Johansson's avatar Lars Johansson
Browse files

Fix issue for encoding url

parent 45d1928f
No related branches found
No related tags found
No related merge requests found
......@@ -161,7 +161,7 @@ public class URLUtility {
encodedURL.append(EncodingUtility.encode(path1));
return encodedURL.toString();
}
encodedURL.append(pathQuery[0]);
encodedURL.append(EncodingUtility.encode(pathQuery[0]));
encodedURL.append(DELIMITER_PATH_QUERY);
// split attribute-value pairs
......
......@@ -41,10 +41,14 @@ class URLUtilityTest {
",",
"'',''",
"' ',+",
"'%',%25",
"'&',%26",
"'?',?",
"abcd1234,abcd1234",
"abcd.xhtml,abcd.xhtml",
"abcd.xhtml?efgh,abcd.xhtml?efgh",
"/abcd.xhtml?uvwx-0%,/abcd.xhtml?uvwx-0%25",
"/uvwx-0%?efgh=ijkl,/uvwx-0%25?efgh=ijkl",
"abcd.xhtml?efg+h,abcd.xhtml?efg%2Bh",
"abcd.xhtml?ef gh,abcd.xhtml?ef+gh",
"abcd.xhtml?efgh=ijkl,abcd.xhtml?efgh=ijkl",
......@@ -53,8 +57,9 @@ class URLUtilityTest {
"abcd.xhtml?efgh=ijkl&mnop=qrst,abcd.xhtml?efgh=ijkl&mnop=qrst",
"abcd.xhtml?efgh=i+kl&mnop=qr t,abcd.xhtml?efgh=i%2Bkl&mnop=qr+t",
"abcd.xhtml?efgh&uvwx=yzabc def++ghijklm+ nop&abcdefgh=,abcd.xhtml?efgh&uvwx=yzabc++def%2B%2Bghijklm%2B+nop&abcdefgh=",
"http://127.0.0.1:8080/a/b/c/d/e/f/RFQ-010:EMR-FS-0%,http://127.0.0.1:8080/a/b/c/d/e/f/RFQ-010%3AEMR-FS-0%25"
"http://127.0.0.1:8080/a/b/c/d/e/f/RFQ-010:EMR-FS-0%,http://127.0.0.1:8080/a/b/c/d/e/f/RFQ-010%3AEMR-FS-0%25",
"http://127.0.0.1:8080/api/v1/structures/mnemonicPath/Sg-A%,http://127.0.0.1:8080/api/v1/structures/mnemonicPath/Sg-A%25",
"http://127.0.0.1:8080/api/v1/structures/mnemonicPath/Sg-A%?statuses=APPROVED&deleted=false,http://127.0.0.1:8080/api/v1/structures/mnemonicPath/Sg-A%25?statuses=APPROVED&deleted=false"
})
void encodeURL(String input, String expected) {
assertEquals(expected, URLUtility.encodeURL(input));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment