Skip to content

Commit

Permalink
fix(formatThumbnailEmbed): escape characters in new URL path (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
wopian authored May 13, 2023
1 parent 199682f commit 4f98569
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/formatThumbnailEmbed.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { URL } from 'node:url'

/**
* Converts the following URL:
*
Expand All @@ -11,7 +13,7 @@ export const formatThumbnailEmbed = (url: string): string => {
if (
url.startsWith('https://storage.googleapis.com/zeepkist-gtr/thumbnails/')
) {
return url
return new URL(url).toString()
}

const baseUrlRegex =
Expand All @@ -31,5 +33,5 @@ export const formatThumbnailEmbed = (url: string): string => {
: part
})
const newPath = newParts.join('/')
return baseUrl + newPath
return new URL(baseUrl + newPath).toString()
}

0 comments on commit 4f98569

Please sign in to comment.