Skip to content

Commit

Permalink
Merge pull request #8234 from ckeditor/i/7488
Browse files Browse the repository at this point in the history
Fix (media-embed): Allow URL with '%' character for embedding media. Closes #7488.
  • Loading branch information
jodator authored Oct 10, 2020
2 parents c8e3a94 + d9325bc commit 5f4c9b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/ckeditor5-media-embed/src/automediaembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions packages/ckeditor5-media-embed/tests/automediaembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,17 @@ describe( 'AutoMediaEmbed - integration', () => {
return newEditor.destroy();
} );
} );

it( 'works for URL with %-symbols', () => {
setData( editor.model, '<paragraph>[]</paragraph>' );
pasteHtml( editor, 'http://youtube.com/watch?v=H08tGjXNHO4%2' );

clock.tick( 100 );

expect( getData( editor.model ) ).to.equal(
'[<media url="http://youtube.com/watch?v=H08tGjXNHO4%2"></media>]'
);
} );
} );

describe( 'use real timers', () => {
Expand Down

0 comments on commit 5f4c9b5

Please sign in to comment.