Support SPDX IDs with dots in license URL slugs#220
Open
Support SPDX IDs with dots in license URL slugs#220
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to T51ENG-1496
Proposed changes
Apache-2.0,GPL-3.0) across three layers: save-time (wp_insert_post_data,wp_unique_post_slug), query-time (sanitize_titlefilter with cached DB lookup), and REST API route regex.cleanForSlugfrom stripping dots — handles both title-driven slug generation (wp.data.subscribe) and manual slug edits (capture-phasefocusoutlistener).falsewas indistinguishable from a cache miss.Why are these changes being made?
WordPress
sanitize_titlestrips dots from slugs by default. SPDX license identifiers use dots as version separators (e.g.,Apache-2.0), so license URLs were being mangled to/license/apache-2-0instead of the canonical/license/apache-2.0. This caused SEO issues and broken links from external sources using the standard SPDX identifiers. The previous approach used the Redirection plugin which created conflicting canonical signals.Testing instructions
Apache-2.0— slug should auto-generate asapache-2.0(notapache-2-0)mit-1.0) — dots should persist after clicking away (brief visualflicker is expected)
/license/apache-2.0on the front end — should resolve to the correct license post/osi/v1/license/apache-2.0REST endpoint — should return the license dataMIT) still work normallysanitize_titlefilter