From 05a0c6a51a70b59fb7c22c4d1f252a248c788d33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kwa=C5=9Bnik?= Date: Fri, 9 Oct 2020 13:22:53 +0200 Subject: [PATCH 1/2] Inserted URL with '%'-symbols is not transformed to Media Object --- packages/ckeditor5-media-embed/src/automediaembed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-media-embed/src/automediaembed.js b/packages/ckeditor5-media-embed/src/automediaembed.js index 1b398d9e538..98d1225c7f3 100644 --- a/packages/ckeditor5-media-embed/src/automediaembed.js +++ b/packages/ckeditor5-media-embed/src/automediaembed.js @@ -16,7 +16,7 @@ import Undo from '@ckeditor/ckeditor5-undo/src/undo'; import global from '@ckeditor/ckeditor5-utils/src/dom/global'; import { insertMedia } from './utils'; -const URL_REGEXP = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]+$/; +const URL_REGEXP = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/; /** * The auto-media embed plugin. It recognizes media links in the pasted content and embeds From d9325bcc04ff4f8bb19c27e426e574c18fff9986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kwa=C5=9Bnik?= Date: Fri, 9 Oct 2020 13:52:24 +0200 Subject: [PATCH 2/2] Added tests --- .../ckeditor5-media-embed/tests/automediaembed.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/ckeditor5-media-embed/tests/automediaembed.js b/packages/ckeditor5-media-embed/tests/automediaembed.js index 6088b500dcb..54063474c3f 100644 --- a/packages/ckeditor5-media-embed/tests/automediaembed.js +++ b/packages/ckeditor5-media-embed/tests/automediaembed.js @@ -398,6 +398,17 @@ describe( 'AutoMediaEmbed - integration', () => { return newEditor.destroy(); } ); } ); + + it( 'works for URL with %-symbols', () => { + setData( editor.model, '[]' ); + pasteHtml( editor, 'http://youtube.com/watch?v=H08tGjXNHO4%2' ); + + clock.tick( 100 ); + + expect( getData( editor.model ) ).to.equal( + '[]' + ); + } ); } ); describe( 'use real timers', () => {