fix file input checking (bug 1030388)

The existing logic was mostly fine.