Adds another check before filename is accepted, preventing invalid filenames.