Skip to content

'Go to Harmony' script runs on the Add Release form #27

Description

@arsinclair

Hello there,

The userscript runs on https://beta.musicbrainz.org/release/add?skip_confirmation=1 however it shouldn't. There's no release on this page. This is because the script match rule is too broad:

https://beta.musicbrainz.org/release/*

Perhaps you need an additional filter within the script, like so:

const releaseGuidMatch = location.pathname.match(
  /^\/release\/[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
);

if (!releaseGuidMatch) {
  return;
}

since @match directives don't support RegEx.

I discovered this because the script actually crashes on the Add Release form, since it cannot find the header element:

Image

This also needs to be mitigated, potentially with an optional chaining, since we cannot assume that document.getElementsByClassName("releaseheader")[0] will always be present.


On another note, I've been helping with maintaining Murdos's Userscripts Repo over the last year or so: would you mind if I integrate your code into the Musicbrainz UI enhancements script? That script already supports flags, so each user can chose what features to enable or disable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions