A platform for community discussion. Free, open, simple.
FIX: Stop non-rgb header background colors crashing DiscourseHub (#31929)
David Taylor5f8a183abf24
diff --git a/app/assets/javascripts/discourse/app/lib/utilities.js b/app/assets/javascripts/discourse/app/lib/utilities.jsindex 2cb955fc57f..17036fa472f 100644--- a/app/assets/javascripts/discourse/app/lib/utilities.js+++ b/app/assets/javascripts/discourse/app/lib/utilities.js@@ -441,9 +441,17 @@ export function prefersReducedMotion() {}export function postRNWebviewMessage(prop, value) {- if (window.ReactNativeWebView !== undefined) {- window.ReactNativeWebView.postMessage(JSON.stringify({ [prop]: value }));+ if (window.ReactNativeWebView === undefined) {+ return;+ }++ if (prop === "headerBg" && !value.startsWith("rgb(")) {+ // eslint-disable-next-line no-console+ console.warn("Skipping unsupported headerBg value:", value);+ return;}++ window.ReactNativeWebView.postMessage(JSON.stringify({ [prop]: value }));}function pickMarker(text) {