Opened 8 years ago

Last modified 8 years ago

#16707 confirmed Bug

double protocol in link plugin when entered URL contains a space in front

Reported by: Devin Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0
Keywords: Cc:

Description

The link plugin does already attempt to remove the protocol on change events to the URL field, but it doesn't account for leading white space. It's understood that the URL shouldn't contain leading white space and this could be considered a user issue. However, later in CKEditor's workflow, it trims the URL specified before saving the result. If the user then re-opens the Link dialog for the link they have created, the URL field will now show the URL containing the protocol, but with the original leading white space removed. As a user at glance, everything looks ok, because I'm not aware that the Link plugin is going to prefix the field's data with the protocol that's currently selected in the drop down. Without triggering any change events, the URL field will remain untouched, still containing the protocol at the beginning.

The link dialog needs to either trim the contents of the URL field before checking for beginning with a protocol, or use a white space delimiter in the protocol regular expression.

Steps to reproduce

  1. Highlight a word and click link button in toolbar
  2. In URL field, enter a space character, then enter a URL prefixed with the protocol http:// (IE, http://www.google.com)
  3. Click OK to save the link
  4. Inspect the URL in the document and verify that the href for the anchor tag contains http://http://www.google.com
  5. Re-open the link dialog for the link in your document.
  6. Verify that the URL field contains the contents http://www.google.com

Expected result

" http://www.google.com" should be trimmed before checking for protocol OR " http://www.google.com" should remain as the actual contents of the URL field (not trimmed before save) so that the user can see the issue that exists.

Actual result

The URL field is not trimmed before checking for protocol but is trimmed before saving the field, thus causing the protocol to exists twice.

Other details (browser, OS, CKEditor version, installed plugins)

Chrome 54.0.2840.99 m Windows 7 Latest CK editor version (can reproduce in demo) Standard edition (specifically link plugin)

Change History (1)

comment:1 Changed 8 years ago by Jakub Ś

Status: newconfirmed
Version: 4.6.04.0

If open link dialog, just paste URL like ' http://google.com' and save changes, you will see that link gets inserted as http://http://o2.pl. There is definitely some trimming missing.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy