From d0ba6c26e64e711e21b191bdba0ede14abc6afb9 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 26 Nov 2021 21:09:12 +0000 Subject: [PATCH] [FIX] website: allow non 400 normal google font When adding a google font, the website test if it is valid with an URL like: https://fonts.googleapis.com/css?family=Open+Sans+Condensed but this is only testing the normal with weight 400 version which might not be available (for "open sans condensed" only 300 and 700 weight is available). Instead with this fix we try: https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300i,400,400i,700,700i which is what is being queried when the font is really used and will only fail if all types are missing (in which case it is a good thing that it fails). opw-2678485 closes odoo/odoo#80564 X-original-commit: 126ccaecb876c17dd6b7e34aef4aa4927d13b8f7 Signed-off-by: Nicolas Lempereur (nle) --- addons/website/static/src/js/editor/snippets.options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/js/editor/snippets.options.js b/addons/website/static/src/js/editor/snippets.options.js index 3cfef39bb7e..5cc1d35e936 100644 --- a/addons/website/static/src/js/editor/snippets.options.js +++ b/addons/website/static/src/js/editor/snippets.options.js @@ -199,7 +199,7 @@ const FontFamilyPickerUserValueWidget = SelectUserValueWidget.extend({ let isValidFamily = false; try { - const result = await fetch("https://fonts.googleapis.com/css?family=" + m[1], {method: 'HEAD'}); + const result = await fetch("https://fonts.googleapis.com/css?family=" + m[1]+':300,300i,400,400i,700,700i', {method: 'HEAD'}); // Google fonts server returns a 400 status code if family is not valid. if (result.ok) { isValidFamily = true;