Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update signed URLs implementation to work with ~ and , #215

Open
rsedykh opened this issue Nov 21, 2023 · 0 comments
Open

Update signed URLs implementation to work with ~ and , #215

rsedykh opened this issue Nov 21, 2023 · 0 comments
Assignees
Labels

Comments

@rsedykh
Copy link
Member

rsedykh commented Nov 21, 2023

Currently URL like /cd334b26-c641-4393-bcce-b5041546430d~11/nth/1/-/crop/250x250/1000,1000/ won't work when signing a URL, because Akamai escape some symbols.

We use tildas in group URLs, and commas in operations like crop and overlay.

Here is a code snippet how it should work:

function escapeEarly(path) {
  return encodeURIComponent(path)
    .replace(/[~'*]/g, function (c) {
      return '%' + c.charCodeAt(0).toString(16);
    })
    .replace(/%../g, function (match) {
      return match.toLowerCase();
    })
    .replace(/%2c/g, ',')
    .replace(/%20/g, '%2520');
}

Test environment — https://uploadcare.com/docs/security/secure-delivery/#test-environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants