Skip to content

Commit 276d8b6

Browse files
authored
Update pywwwget_deepseek.py
1 parent 39369f4 commit 276d8b6

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

PyWWW/pywwwget_deepseek.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -623,20 +623,15 @@ def _wrap_text(binary_handle):
623623

624624
def detect_cwd(ftp, file_dir):
625625
"""
626-
Test whether CWD into file_dir works.
627-
Returns True if it does, False if not (so absolute paths should be used).
626+
Test whether cwd into file_dir works. Returns True if it does,
627+
False if not (so absolute paths should be used).
628628
"""
629-
if not file_dir or file_dir in ("/", "", "."):
630-
return False # nothing to CWD into
631-
629+
if not file_dir:
630+
return False # nothing to cwd into
632631
try:
633-
# Save current directory
634-
orig_pwd = ftp.pwd()
635632
ftp.cwd(file_dir)
636-
# Restore original directory
637-
ftp.cwd(orig_pwd)
638633
return True
639-
except Exception:
634+
except all_errors:
640635
return False
641636

642637
def _ftp_login(ftp, user, pw):
@@ -3367,4 +3362,4 @@ def recv_to_path(url, out_path, auto_extract=False, extract_dir=None,
33673362
sys.exit(1)
33683363
else:
33693364
print("PyWWW-Get (Optimized) v%s" % __version__)
3370-
print("Use '%s help' for usage." % sys.argv[0])
3365+
print("Use '%s help' for usage." % sys.argv[0])

0 commit comments

Comments
 (0)