Disallow file and folder names that end with dots

Fixes:
#5468 (although I was never able to entire reproduce this case)
#7224