fix: Remove double encoding for OG image URLs (#17872)

* fix: do not use vercel image api for meeting link preview image

* fix

* fix

* remove double encoding

* fix

* fix test

* fix

* fix

* fix test

* fix

* fix

* remove test tag

* fix
This commit is contained in:
Benny Joo authored and GitHub committed 2024-11-27 15:45:54 +00:00
1 parent 999019c6f0
commit a7e99f3674
5 files changed
+13 -18

No files matched your search

+1 -1
View File
@@ -87,7 +87,7 @@ export default async function handler(req: NextApiRequest) {
return new Response(img.body, {
status: 200,
headers: { "Content-Type": "image/png", "cache-control": "max-age=86400" },
headers: { "Content-Type": "image/png", "cache-control": "max-age=0" },
});
}
case "app": {
+2 -2
View File
@@ -55,10 +55,10 @@ test("check SSR and OG - User Event Type", async ({ page, users }) => {
expect(canonicalLink).toEqual(`${WEBAPP_URL}/${user.username}/30-min`);
// Verify that there is correct URL that would generate the awesome OG image
expect(ogImage).toContain(
"/_next/image?w=1200&q=100&url=%2Fapi%2Fsocial%2Fog%2Fimage%3Ftype%3Dmeeting%26title%3D"
"/_next/image?w=1200&q=100&url=%2Fapi%2Fsocial%2Fog%2Fimage?type=meeting&title=30%20min"
);
// Verify Organizer Name in the URL
expect(ogImage).toContain("meetingProfileName%3DTest%2520User%26");
expect(ogImage).toContain("meetingProfileName=Test%20User");
});
todo("check SSR and OG - Team Event Type");
@@ -387,7 +387,7 @@ test.describe("Bookings", () => {
});
});
test("check SSR and OG ", async ({ page, users, orgs }) => {
test("check SSR and OG", async ({ page, users, orgs }) => {
const name = "Test User";
const org = await orgs.create({
name: "TestOrg",
@@ -428,10 +428,10 @@ test.describe("Bookings", () => {
expect(canonicalLink).toEqual(`${orgOrigin}${calLink}`);
// Verify that there is correct URL that would generate the awesome OG image
expect(ogImage).toContain(
"/_next/image?w=1200&q=100&url=%2Fapi%2Fsocial%2Fog%2Fimage%3Ftype%3Dmeeting%26title%3D"
"/_next/image?w=1200&q=100&url=%2Fapi%2Fsocial%2Fog%2Fimage?type=meeting&title="
);
// Verify Organizer Name in the URL
expect(ogImage).toContain("meetingProfileName%3DTest%2520User%26");
expect(ogImage).toContain("meetingProfileName=Test%20User");
}
);
});
@@ -66,9 +66,7 @@ test.describe("User Avatar", async () => {
// yes, OG image URI encodes at multiple places.. don't want to mess with that.
await expect(page.locator('meta[property="og:image"]')).toHaveAttribute(
"content",
new RegExp(
encodeURIComponent(`meetingImage=${encodeURIComponent(`${CAL_URL}/api/avatar/${objectKey}.png`)}`)
)
new RegExp(`meetingImage=${encodeURIComponent(`${CAL_URL}/api/avatar/${objectKey}.png`)}`)
);
});
});