force loading images with https
This commit is contained in:
parent
76843ba7e8
commit
bc2a15bc40
1 changed files with 7 additions and 2 deletions
|
@ -53,14 +53,19 @@ interface PostMediaProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
function PostMediaItem({ media }: PostMediaProps) {
|
function PostMediaItem({ media }: PostMediaProps) {
|
||||||
const url = media.url.toString()
|
const url = new URL(media.url.toString())
|
||||||
|
|
||||||
|
if (location.protocol === 'https:' && url.protocol !== 'https:') {
|
||||||
|
url.protocol = 'https:'
|
||||||
|
}
|
||||||
|
|
||||||
const width = media.width ?? undefined
|
const width = media.width ?? undefined
|
||||||
const height = media.height ?? undefined
|
const height = media.height ?? undefined
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
src={url}
|
src={url.toString()}
|
||||||
alt="todo sry :("
|
alt="todo sry :("
|
||||||
className="w-full h-auto"
|
className="w-full h-auto"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue