Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

EncodeURI origin app-bridge #1612

Merged
merged 1 commit into from
Aug 26, 2020
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: 3 additions & 1 deletion packages/koa-shopify-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<!-- ## [Unreleased] -->
## [Unreleased]

- URI encode `config` on redirection page [1612](https://github.com/Shopify/quilt/pull/1612)

## [3.1.65] - 2020-07-06

Expand Down
2 changes: 1 addition & 1 deletion packages/koa-shopify-auth/src/auth/redirection-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function redirectionScript({origin, redirectTo, apiKey}) {
var Redirect = AppBridge.actions.Redirect;
var app = createApp({
apiKey: '${apiKey}',
shopOrigin: '${origin}',
shopOrigin: "${encodeURI(origin)}",
keyfer marked this conversation as resolved.
Show resolved Hide resolved
});
var redirect = Redirect.create(app);
redirect.dispatch(Redirect.Action.REMOTE, '${redirectTo}');
Expand Down
15 changes: 15 additions & 0 deletions packages/koa-shopify-auth/src/auth/test/redirection-page.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import redirectionScript from '../redirection-page';

const origin = 'https://shopify.com/?x=шеллы';
const redirectTo = 'shop1.myshopify.io';
const apiKey = 'fakekey';

describe('redirectionScript', () => {
it('returns a script tag with formatted data', () => {
const script = redirectionScript({origin, redirectTo, apiKey});

expect(script).toContain(
keyfer marked this conversation as resolved.
Show resolved Hide resolved
'shopOrigin: "https://shopify.com/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"',
);
});
});