Gracefully handle trailing slashes after directories.