diff --git a/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js b/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js index 517d6276..b78a00e3 100644 --- a/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js +++ b/src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js @@ -125,7 +125,15 @@ const VIEWPORT_TOP_OFFSET_DISTRACTION_FREE_MODE = 0; const wrapper = this.getHTMLDocumentFragment(container.closest('.ibexa-data-source').querySelector('textarea').value); const section = wrapper.childNodes[0]; const { toolbar, extraPlugins = [], extraConfig = {} } = window.ibexa.richText.CKEditor; - const locale = new Intl.Locale(doc.querySelector('meta[name="LanguageCode"]').content); + let locale; + try { + locale = new Intl.Locale(doc.querySelector('meta[name="LanguageCode"]').content); + } catch (e) { + console.warn( + `Unsupported LanguageCode '${doc.querySelector('meta[name="LanguageCode"]').content}' - using fallback 'eng-GB'.`, + ); + locale = new Intl.Locale('eng-GB'); + } const blockCustomStyles = Object.entries(ibexa.richText.customStyles) .filter(([, customStyleConfig]) => !customStyleConfig.inline) .map(([customStyleName, customStyleConfig]) => { diff --git a/src/bundle/Resources/richtext/schemas/docbook/docbook.iso.sch b/src/bundle/Resources/richtext/schemas/docbook/docbook.iso.sch index 4129880d..c206b52c 100644 --- a/src/bundle/Resources/richtext/schemas/docbook/docbook.iso.sch +++ b/src/bundle/Resources/richtext/schemas/docbook/docbook.iso.sch @@ -249,8 +249,24 @@ + + - using scripts in links is not allowed + + links must start with one of: http://, https://, mailto:, ezcontent://, ezlocation://, ezremote://, ezurl://, /, # + using characters [< > "] in links is not allowed diff --git a/src/bundle/Resources/richtext/schemas/docbook/docbook.iso.sch.xsl b/src/bundle/Resources/richtext/schemas/docbook/docbook.iso.sch.xsl index 075885c0..6e4551bc 100644 --- a/src/bundle/Resources/richtext/schemas/docbook/docbook.iso.sch.xsl +++ b/src/bundle/Resources/richtext/schemas/docbook/docbook.iso.sch.xsl @@ -73,10 +73,13 @@ ezlink must not occur in the descendants of link - + -using scripts in links is not allowed +links must start with one of: http://, https://, mailto:, ezcontent://, ezlocation://, ezremote://, ezurl://, /, # + + +using characters [< > "] in links is not allowed diff --git a/tests/lib/FieldType/RichTextTest.php b/tests/lib/FieldType/RichTextTest.php index f18d1a1f..b37af517 100644 --- a/tests/lib/FieldType/RichTextTest.php +++ b/tests/lib/FieldType/RichTextTest.php @@ -229,7 +229,37 @@ public function providerForTestValidate() [ new ValidationError( "Validation of XML content failed:\n" . - '/section/para/link: using scripts in links is not allowed', + '/section/para/link: links must start with one of: http://, https://, mailto:, ezcontent://, ezlocation://, ezremote://, ezurl://, /, #', + null, + [], + 'xml' + ), + ], + ], + [ + ' +
+ link +
', + [ + new ValidationError( + "Validation of XML content failed:\n" . + '/section/para/link: links must start with one of: http://, https://, mailto:, ezcontent://, ezlocation://, ezremote://, ezurl://, /, #', + null, + [], + 'xml' + ), + ], + ], + [ + ' +
+ link +
', + [ + new ValidationError( + "Validation of XML content failed:\n" . + '/section/para/link: using characters [< > "] in links is not allowed', null, [], 'xml' @@ -244,7 +274,7 @@ public function providerForTestValidate() [ new ValidationError( "Validation of XML content failed:\n" . - '/section/para/link: using scripts in links is not allowed', + '/section/para/link: links must start with one of: http://, https://, mailto:, ezcontent://, ezlocation://, ezremote://, ezurl://, /, #', null, [], 'xml'