Validate the file name derived from `origin` in `get_file` (#23330)