Handle unknown file types

From #3667.