Skip to content

Commit be74765

Browse files
committed
Normalize protocol relative URLs
1 parent b9f715d commit be74765

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/app/conf/2025/components/session-opengraph-image.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ScheduleSession } from "@/app/conf/2025/schedule/_components/session-list"
22
import type { SchedSpeaker } from "@/app/conf/2023/types"
3-
import { ConferenceOpengraphImageHeader } from "./speaker-opengraph-image"
3+
import { ConferenceOpengraphImageHeader, normalizeProtocolRelativeUrl } from "./speaker-opengraph-image"
44
import { getEventTitle } from "../utils"
55
import { formatSpeakerPosition } from "./format-speaker-position"
66

@@ -65,7 +65,7 @@ export default function ScheduleOpengraphImage({
6565
<div className="relative overflow-hidden">
6666
<div className="absolute inset-0 z-[1] bg-sec-lighter mix-blend-multiply" />
6767
<img
68-
src={speakers[0].avatar}
68+
src={normalizeProtocolRelativeUrl(speakers[0].avatar)}
6969
alt=""
7070
className="size-[120px] object-cover"
7171
width={120}
@@ -110,3 +110,5 @@ export default function ScheduleOpengraphImage({
110110
</article>
111111
)
112112
}
113+
114+

src/app/conf/2025/components/speaker-opengraph-image.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function SpeakerOpengraphImage({
5858
<div className="relative flex overflow-hidden border-l-2 border-neu-300">
5959
<div className="absolute inset-0 z-[1] bg-sec-lighter mix-blend-multiply" />
6060
<img
61-
src={speaker.avatar}
61+
src={normalizeProtocolRelativeUrl(speaker.avatar)}
6262
alt=""
6363
className="object-cover"
6464
width={RIGHT_COLUMN_WIDTH_PX}
@@ -133,3 +133,10 @@ export function ConferenceOpengraphImageHeader({
133133
</header>
134134
)
135135
}
136+
137+
export function normalizeProtocolRelativeUrl(url: string) {
138+
if (url.startsWith("//")) {
139+
return `https:${url}`
140+
}
141+
return url
142+
}

0 commit comments

Comments
 (0)