That method seems to behave, wouldn't you say Rob?
‘Stripping stuff after the last /‘
To me, if there is nothing after the last / then it should return everything up to and including the last /. You could change the description of the api to ‘Stripping everything after the last / that is followed by stuff’.
It appears to be an API call that was used by just me, or if used by others then their interpretation is different from mine. I wouldn’t spend anymore time on it if you’re happy with the definition and how it works. I can make it work now, or I can just not support variants.