Skip to content

Commit d503e4e

Browse files
committed
use URLSearchParams
1 parent 47b7ccc commit d503e4e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/gooeyFileInput.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,11 @@ async function loadPreview({
262262
preview?: string;
263263
}) {
264264
if (uppy.getFile(fileId).meta.type?.startsWith("image/")) return;
265-
266-
const response = await fetch(
267-
`https://metascraper.gooey.ai/fetchUrlMeta?url=${url}`
268-
);
265+
const metaScrapperApi = "https://metascraper.gooey.ai/fetchUrlMeta";
266+
const params = new URLSearchParams({ url });
267+
const apiUrl = new URL(metaScrapperApi);
268+
apiUrl.search = params.toString();
269+
const response = await fetch(apiUrl);
269270
const data = await response.json();
270271
const { content_type: contentType, image, title } = data;
271272
const contentLength = response.headers.get("content-length");

0 commit comments

Comments
 (0)