Fixed the Result of file.replace (#15417)

Fix #15417