Handle gracefully trailing slashes when resolving SWHID in search box
The following URL, made up of a SWHID and a resolver works perfectly:
On the other side, entering the string obtained removing the resolver from the above URL is not accepted if used in the search box at archive.softwareheritage.org (incomplete format error)
swh:1:cnt:bb0faf6919fc60636b2696f32ec9b3c2adb247fe;origin=https://github.com/id-Software/Quake-III-Arena;lines=549-572/
The issue is with the trailing / that is not part of the SWHID grammar, and is hence properly rejected, but it can be surprising for the users.
Nonetheless, we should handle this case gracefully: silently remove any trailing / in case of parsing error, and retrying before failing.
Migrated from T3234 (view on Phabricator)