trying to avoid invalid file downloads