Make WordPress Core

Opened 4 months ago

Last modified 2 months ago

#65417 assigned defect (bug)

Bug: Classic Editor link dialog prepends http:// to URLs with uppercase protocol

Reported by: nimeshatxecurify Owned by: nimeshatxecurify
Priority: normal Milestone: 7.2
Component: Editor Version:
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: javascript

Description (last modified by sabernhardt)

Steps to Reproduce

  1. Go to http://localhost:8889/wp-admin
  2. Create or edit a post/page
  3. Switch to the Classic Editor (Visual tab)
  4. Select some text (e.g. "click here") OR place the cursor in the editor
  5. Click the Insert/Edit Link button (chain icon in the toolbar)
  6. In the URL field, type: HTTPS://example.com (uppercase protocol — common on mobile keyboards with auto-capitalization)
  7. Click outside the URL field / press Tab (triggers the blur event → correctURL runs)

Expected: URL remains HTTPS://example.com (or is normalized to https://example.com)

Actual: URL becomes http://HTTPS://example.com — a completely broken double-protocol URL

Attachments (5)

Add-Post-‹-WordPress-Develop-—-WordPress.png​ (158.4 KB ) - added by nimeshatxecurify 4 months ago.
Not repeat link on every click.png​ (28.9 KB ) - added by sanayasir 3 months ago.
screenshot-wpbackend.png​ (112.4 KB ) - added by shailesh7714 3 months ago.
Please find the attached screenshot. Kindly review it
After patch.png​ (91.4 KB ) - added by mdridipu 2 months ago.
Before patch.png​ (84.3 KB ) - added by mdridipu 2 months ago.

Download all attachments as: .zip

Change History (26)

This ticket was mentioned in ​PR #12103 on ​WordPress/wordpress-develop by ​@nimeshatxecurify.


4 months ago
#1

  • Keywords has-patch has-unit-tests added

Updates the regex used in the link dialog to support schemes with uppercase letters. This prevents the editor from prepending http:// to URLs like HTTPS:// or Http://, which are commonly produced by mobile keyboards.

Includes new QUnit tests to verify correct handling of uppercase, mixed-case, fragment, and root-relative URLs.

Trac ticket: https://core.trac.wordpress.org/ticket/65417

## Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Sonnet 4.6

#2 @nimeshatxecurify
4 months ago

  • Keywords needs-testing added

This ticket was mentioned in ​Slack in #core by nimeshatxecurify. ​View the logs.


4 months ago

This ticket was mentioned in ​Slack in #core by abdullahramzan. ​View the logs.


4 months ago

#5 @divyeshk71
4 months ago

Hello,

I have reviewed this issue. Now it seems the issue has been fixed.

Thanks.

#6 @sabernhardt
4 months ago

  • Description modified (diff)

#7 @jadavsanjay
4 months ago

Test Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/12103

Environment

  • WordPress: 7.1-alpha-20260605.071112
  • Subdirectory: No
  • PHP: 8.3.31
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 148.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Classic Editor 1.7.0
    • Test Reports 1.3.0

Steps taken

  1. ✅ Patch is solving the problem

Expected result

  • After applying the patch, the issue with Classic Editor link dialog prepends ​http:// to URLs with uppercase protocol has been resolved.

Screenshots/Screencast with results

https://i.postimg.cc/jwwgZDGg/before.png
https://i.postimg.cc/FddWDY2p/after.png

#8 @tusharaddweb
4 months ago

Tested patch. Uppercase protocol issue is fixed.

Typed HTTPS://example.com in the URL field, and after blur/Tab it correctly remains as uppercase (or normalizes to lowercase) instead of prepending http://.

No double-protocol URLs. Works as expected.

#9 @jorbin
4 months ago

  • Milestone Awaiting Review → 7.1

Confirmed in 6.9 as well. Moving to 7.1 for consideration.

#10 @darshitrajyaguru97
4 months ago

Test Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/12103

Environment

  • WordPress: 7.1-alpha-20260605.071112
  • Subdirectory: No
  • PHP: 8.3.31
  • Database: WP_SQLite_Driver
  • Browser: Chrome
  • OS: Windows 11
  • Theme: Twenty Twenty-Five
  • MU Plugins: None activated
  • Plugins:
    • Classic Editor 1.7.0
    • Test Reports 1.3.0

Steps taken

  • Applied the patch from the PR.
  • Tested the Classic Editor link dialog with URLs containing uppercase protocol values.

Result

  • Patch successfully resolves the reported issue.
  • URLs with uppercase protocols no longer get incorrectly modified by prepending http://.

Expected result

The Classic Editor link dialog should preserve the original URL protocol format without adding an unwanted http:// prefix.

#11 @sanayasir
3 months ago

I tested this issue in WordPress Playground with the Classic Editor plugin enabled. Following the reported reproduction steps, I entered an uppercase protocol (HTTPS://seorepairkit.com) in the link URL field and triggered the blur event by moving focus away from the input. The URL was handled correctly and was not modified to ​http://HTTPS://seorepairkit.com. I also verified that repeatedly opening and interacting with the link did not result in an additional ​http:// prefix being added. The protocol was preserved (or normalized to lowercase) without creating a duplicate protocol.

@shailesh7714
3 months ago

Please find the attached screenshot. Kindly review it

#12 @sanayasir
3 months ago

  • Keywords needs-testing removed

#13 @jamesbregenzer
3 months ago

Tested using the WordPress Playground instance linked from the GitHub PR.

Environment

  • WordPress Playground (PR preview)
  • Browser: Firefox
  • OS: macOS

Tested

Confirmed uppercase and mixed-case URL schemes are preserved correctly and ​http:// is no longer prepended. Existing lowercase protocols, relative URLs, and fragment links also continue to behave as expected. I also verified the links after saving the post, reloading the editor, and editing the links again.

Patch tested successfully.

This ticket was mentioned in ​Slack in #core by adrianduffell. ​View the logs.


3 months ago

#15 @nimeshatxecurify
3 months ago

  • Owner set to nimeshatxecurify
  • Status new → assigned

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


3 months ago

This ticket was mentioned in ​Slack in #core-test by noruzzaman. ​View the logs.


2 months ago

​nazmulasif commented on ​PR #12103:


2 months ago
#18

Test Report
Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/12103

Environment

  • WordPress: 7.1-beta4-20260730.062011
  • Subdirectory: No
  • PHP: 8.5.8 (cli)
  • Server: PHP.wasm (Emscripten 4.0.19 wasm32)
  • Database: WP_MySQL_On_SQLite (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 150.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.5
  • MU Plugins: None activated
  • Plugins:
    • Classic Editor 1.7.0
    • Test Reports 1.3.0

Steps taken

  1. Opened WordPress Playground PR preview for PR #12103 (Trac #65417) with the Classic Editor active.
  2. Navigated to Posts > Add New and created a Classic Editor instance.
  3. Added sample text, selected it, and clicked the Insert/Edit Link icon in the toolbar.
  4. Clicked the Link Options gear icon (⚙️) to open the full wpLink modal dialog.
  5. In the URL field, entered a URL with an uppercase protocol (https://example.com/ and http://example.com/).
  6. Moved focus away from the input field (triggered blur event / wpLink.correctURL()) and submitted the link dialog.
  7. Also verified directly in the browser developer console by targeting the modal input DOM element: `javascript jQuery('#wp-link-url').val('​https://example.com/'); wpLink.correctURL(); console.log(jQuery('#wp-link-url').val()); Result: "​https://example.com/"
  1. Confirmed that the URL protocol is preserved as entered without prepending http://.
  • ✅ Patch is solving the problem

Expected result
URLs containing uppercase or mixed-case protocols (e.g. https://example.com/ or http://example.com/) should be recognized as already having a scheme and should NOT have http:// prepended to create broken double-protocol URLs (http://https/://example.com).

Additional Notes
Tested and verified pull request #12103 for Trac #65417.

Screenshots/Screencast with results
Attached: showing manual test verification in post editor

Support Content
Trac Ticket: https://core.trac.wordpress.org/ticket/65417

​https://github.com/user-attachments/assets/66a8b918-c8cc-4436-9994-5be0a140dc73

This ticket was mentioned in ​Slack in #core by adrianduffell. ​View the logs.


2 months ago

@mdridipu
2 months ago

#20 @mdridipu
2 months ago

Test Report

Environment:

WordPress: 7.1 Beta 4
PHP: 8.3.x
OS: Windows 11
Browser: Google Chrome
Theme: Twenty Twenty-Five
Plugins: Classic editor

Result:
✅Patch tested and works as expected.

I successfully reproduced the reported issue before applying the proposed patch from PR #12103. After applying the patch, I repeated the same reproduction steps and confirmed that the URL is handled correctly when entering an uppercase protocol (HTTPS://). I did not observe any regressions while testing the Classic Editor link dialog.

Screenshots: Attached (before and after applying the patch).


#21 @wildworks
2 months ago

  • Milestone 7.1 → 7.2

I apologize, but I couldn't secure enough time to review this PR. Let me punt this to 7.2.

Note: See TracTickets for help on using tickets.