File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -200,15 +200,23 @@ def check_file_exists(self, remote_cmd: str = "") -> bool:
200200 if not remote_cmd :
201201 remote_cmd = f'/file print detail where name="{ self .file_system } /{ self .dest_file } "'
202202 remote_out = self .ssh_ctl_chan ._send_command_timing_str (remote_cmd )
203- # Output will look like
204- # 0 name="flash/test9.txt" type=".txt file" size=19 creation-time=jun...
205- # fail case will be blank line (all whitespace)
203+ # Possible outputs:
204+ # - Normal entry containing 'size' and the filename
205+ # 0 name="flash/test9.txt" type=".txt file" size=19 creation-time=...
206+ # - Some firmware versions print flags then the entry
207+ # Flags: S - shared
208+ # 0 name="flash/test9.txt" type=".txt file" size=19 creation-time=...
209+ # - Or only the flags (no matching file), or entirely blank on failure
210+ # Flags: S - shared
211+ # <no matching file line>
206212 if (
207213 "size" in remote_out
208214 and f"{ self .file_system } /{ self .dest_file } " in remote_out
209215 ):
210216 return True
211- elif not remote_out .strip ():
217+ elif not remote_out .strip () or (
218+ "Flags:" in remote_out and "size" not in remote_out
219+ ):
212220 return False
213221 raise ValueError ("Unexpected output from check_file_exists" )
214222 elif self .direction == "get" :
You can’t perform that action at this time.
0 commit comments