Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserted URL with '%'-symbols is not transformed to Media Object #8234

Merged
merged 2 commits into from
Oct 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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