Thnk you, Andrew! Your code works charmingly! But I wanted to offer something in line of Find-Replace (out of pure research interest). And I managed to get the expected result (at least on my system):
Before hosted at ImgBB — ImgBB
After hosted at ImgBB — ImgBB
However, to be honest, I don't see a practical value of deleting final spaces in footnotes.