identifiers/resolve_swhid: Handle directory path without trailing slash
This fixes an issue when users forgot to add a trailing slash to the URL resolving a SWHID targetting a non root directory.
Closes #2742 (closed)
Migrated from D4385 (view on Phabricator)