Make sure text is a string for file.contains, Fix #6817