Skip to content

Commit

Permalink
Merge branch 'main' into issue/org.json-update
Browse files Browse the repository at this point in the history
  • Loading branch information
LSantha authored Oct 17, 2023
2 parents e43e11b + 6a102d1 commit 99060df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static String escape(final String path, final String queryString, final S
}
} else {
escaped = sb.append("#")
.append(replaceEncodedCharacters(URLEncoder.encode(fragment, StandardCharsets.UTF_8.name())))
.append(replaceEncodedCharactersInFragment(URLEncoder.encode(fragment, StandardCharsets.UTF_8.name())))
.toString();
}
}
Expand Down Expand Up @@ -212,7 +212,7 @@ private static String newPlaceholder(final String str) {
return placeholderBuilder.toString();
}

private static String replaceEncodedCharacters(final String str) {
private static String replaceEncodedCharactersInFragment(final String str) {
return str.replace("%2B", "+")
.replace("%3D", "=")
.replace("%7E", "~")
Expand All @@ -225,6 +225,8 @@ private static String replaceEncodedCharacters(final String str) {
.replace("%27", "'")
.replace("%28", "(")
.replace("%29", ")")
.replace("%2C", ",");
.replace("%2C", ",")
.replace("%2F", "/")
.replace("%3F", "?");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,12 @@ void decode_whenCampaignPatternIsPresentInTheString_thenCampaignPatternIsNotAffe
String decodedPath = LinkUtil.decode(encodedPath);
assertEquals(encodedPath, decodedPath);
}

@Test
void escape_whenEscapingPathWithFragment_thenFragmentForwardSlashIsNotEncoded() throws UnsupportedEncodingException {
String path = "https://google.com";
String fragment = "/assets/2/1529/RES176341/report";
String escapedPAth = LinkUtil.escape(path, null, fragment);
assertEquals(path+ "#" + fragment, escapedPAth);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

var NS = "cmp";
var IS = "pdfviewer";
var SDK_URL = "https://documentservices.adobe.com/view-sdk/viewer.js";
var SDK_URL = "https://acrobatservices.adobe.com/view-sdk/viewer.js";
var SDK_READY_EVENT = "adobe_dc_view_sdk.ready";

var selectors = {
Expand Down

0 comments on commit 99060df

Please sign in to comment.