Repository navigation
Conversation
Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X3oDSXQzXqDWGmZ2ER5y1U
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +11 B (0%) Total Size: 8.66 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in
|
Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X3oDSXQzXqDWGmZ2ER5y1U
+ or - in prependHTTPprependHTTP more semantic
Co-authored-by: t-hamano <54422211+t-hamano@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X3oDSXQzXqDWGmZ2ER5y1U
What?
I noticed this while reviewing WordPress/wordpress-develop#12103.
Updates the regular expression used by
prependHTTPandprependHTTPSto detect whether a URL already has a scheme.Why?
prependHTTPandprependHTTPSappear to have been created based oncorrectURLin the classic editor (see #5917). However, a bug was reported wherecorrectURLprependshttp://even when it shouldn't. This PR updates the regular expression used byprependHTTPandprependHTTPSto a more semantic one, following the implementation being proposed in core.How?
Previously, only a scheme made up of letters followed by a colon was recognized. As a result, a URL whose scheme contains digits,
+or-, such aschrome-extension://orweb+demo2://, gothttp://prepended.This PR additionally recognizes a scheme that starts with a letter and contains letters, digits,
+or-, but only when it is followed by//. Requiring//keeps the existing behavior for a bare host and port such asmy-site:8080/pathorsite1:80, which still gethttp://prepended. A scheme of letters only is still recognized with just a colon, as before.chrome-extension://abcdef/options.htmlhttp://chrome-extension://abcdef/options.htmlweb+demo2://wordpress.orghttp://web+demo2://wordpress.orgHTTPS://wordpress.org,Http://wordpress.org,mailto:foo@wordpress.orglocalhost:8888my-site:8080/path,site1:80,wordpress.org:8080/pathhttp://prependedhttp://prependedTesting Instructions
chrome-extension://abcdef/options.htmland press Enter.https://chrome-extension://abcdef/options.html.chrome-extension://abcdef/options.html.my-site:8080/pathand confirm thathttps://is prepended, as on trunk.HTTPS://wordpress.organd confirm that it is kept as is, as on trunk.Testing Instructions for Keyboard
Same as above. Use
Cmd/Ctrl + Kto open the link UI.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Used for: Implementing the change, updating the unit tests, and drafting this description. Reviewed by me.