Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/cloudfront-signer/src/sign.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ describe("getSignedUrl- when signing a URL with a date range", () => {
});

describe("url component encoding", () => {
it("should use extended encoding for query params in the base URL", () => {
it("should use standard encoding for query params in the base URL", () => {
const url =
"https://d111111abcdef8.cloudfront.net/private-content/private.jpeg?q=!@#$%^&*()&image-description=aws's image&'''&!()=5";
const signedUrl = getSignedUrl({
Expand All @@ -823,7 +823,7 @@ describe("url component encoding", () => {
});

const target =
"https://d111111abcdef8.cloudfront.net/private-content/private.jpeg?q=%21%40%23%24%25%5E&%2A%28%29=&image-description=aws%27s%20image&%27%27%27=&%21%28%29=5";
"https://d111111abcdef8.cloudfront.net/private-content/private.jpeg?q=!%40%23%24%25%5E&*()=&image-description=aws's%20image&'''=&!()=5";

expect(signedUrl.slice(0, target.length)).toBe(target);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/cloudfront-signer/src/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function getSignedUrl({
if (url.includes("?")) {
const [hostAndPath, query] = url.split("?");
const params = [...new URLSearchParams(query).entries()]
.map(([key, value]) => `${extendedEncodeURIComponent(key)}=${extendedEncodeURIComponent(value)}`)
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
.join("&");
return `${hostAndPath}?${params}`;
}
Expand Down
Loading