Skip to content

Commit 6cab788

Browse files
committed
fix(oembed): make sure we have a valid embedUrl
1 parent a639b62 commit 6cab788

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lambda/oembed/oembed.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ function handler(event, context, callback) {
5252

5353
// map /gist urls to /embed
5454
const url = pathname.startsWith('/gist/')
55-
? params.url.replace('/gist/', '/embed/')
56-
: params.url;
55+
? pathname.replace('/gist/', '/embed/')
56+
: pathname;
57+
const embedUrl = `${host}/${url}?panes=query,preview`;
5758

5859
callback(null, {
5960
statusCode: 200,
@@ -66,7 +67,7 @@ function handler(event, context, callback) {
6667
provider_name: 'testing-playground.com',
6768
provider_url: host,
6869

69-
html: `<iframe src="${url}" height="${maxheight}" width="${maxwidth}" scrolling="no" frameBorder="0" allowTransparency="true" title="Testing Playground" style="overflow: hidden; display: block; width: 100%"></iframe>`,
70+
html: `<iframe src="${embedUrl}" height="${maxheight}" width="${maxwidth}" scrolling="no" frameBorder="0" allowTransparency="true" title="Testing Playground" style="overflow: hidden; display: block; width: 100%"></iframe>`,
7071
width: maxwidth,
7172
height: maxheight,
7273

0 commit comments

Comments
 (0)