Fix for hexadecimal branch deletion

Merged Robert May requested to merge fix-hex-branch-deletion into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Ensures that branches that somehow were created with 40 character hexadecimal branch names (either before they were blocked or by some other means) can be deleted.

Resolves #346478 (closed)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.