Also log the non-HTTPS URL case in safeImageUrl

When I added this new error case in the last change, I made it log to Sentry, because I don't think this should be possible under our data set, so if it happens I want to hear about it. Same is true for this error case, so let's log it too!
This commit is contained in:
Emi Matchu 2021-02-09 16:13:18 -08:00
parent 330e4ee12e
commit 10aa4f9905

View file

@ -138,9 +138,11 @@ export function safeImageUrl(urlString) {
}
if (url.protocol !== "https:") {
console.warn(
`safeImageUrl was provided an unsafe URL, but we don't know how to ` +
`upgrade it to HTTPS: ${urlString}. Returning a placeholder.`
logAndCapture(
new Error(
`safeImageUrl was provided an unsafe URL, but we don't know how to ` +
`upgrade it to HTTPS: ${urlString}. Returning a placeholder.`
)
);
return "https://impress-openneo.net/__error__URL-was-not-HTTPS__";
}