Skip to content

Commit 398c174

Browse files
committed
fix(oembed): fix searchParams
1 parent 6cab788 commit 398c174

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lambda/oembed/oembed.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function handler(event, context, callback) {
3838
);
3939
}
4040

41-
const { hostname, pathname } = new URL(params.url);
41+
const { hostname, pathname, searchParams } = new URL(params.url);
4242

4343
// verify if the url is supported, basically we only allow localhost if we're
4444
// running at localhost, and testing-playground.com as host. And either no
@@ -54,7 +54,10 @@ function handler(event, context, callback) {
5454
const url = pathname.startsWith('/gist/')
5555
? pathname.replace('/gist/', '/embed/')
5656
: pathname;
57-
const embedUrl = `${host}/${url}?panes=query,preview`;
57+
if(!searchParams.get('panes')){
58+
searchParams.set('panes','query,preview')
59+
}
60+
const embedUrl = `${host}/${url}?${searchParams.toString()}`;
5861

5962
callback(null, {
6063
statusCode: 200,

0 commit comments

Comments
 (0)