Fix #5956 - handle file input with stripping text