MBS-13541: Accept uppercase MBIDs in JavaScript #3235
Merged
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.
MBS-13541
Update MBID_REGEXP and isGuid() to additionally match UUIDs containing uppercase letters (as recommended by RFC 4122). Previously, Autocomplete 2 would fail to extract MBIDs containing uppercase letters within pasted URLs.
Problem
As discussed in https://community.metabrainz.org/t/boom-boom-not-recognized-as-a-work-when-pasting-in-add-relationship-dialog-on-add-standalone-recording/690757, the relationship editor doesn't recognize MBIDs with capital A-F within pasted URLs.
(This seems like a minor issue since the MBS always lowercases MBIDs, as far as I can tell, but URLs like https://musicbrainz.org/artist/65F4F0C5-EF9E-490C-AEE3-909E7AE6B2AB work and don't get redirected or rewritten automatically.)
Per https://datatracker.ietf.org/doc/html/rfc4122#section-3, uppercase letters should be accepted in UUIDs:
Solution
This change updates the
MBID_REGEXP
regular expression to be case-insensitive, and also updates theMBID_ONLY_REGEXP
regexp used byisGuid()
.I'm still making
Autocomplete2
lowercase extracted MBIDs before passing them to the/ws/js/entity
endpoint.Per @mwiencek at https://tickets.metabrainz.org/browse/MBS-13541?focusedId=71904&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-71904, this shouldn't affect database validation since MBIDs are only generated in Perl and are stored using the case-insensitive
UUID
PostgreSQL type.Testing
I added a new test case for
isGuid()
and have manually tested that the relationship editor now recognizes MBIDs containing capital letters.