You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(application): FTP.make's args rejects bytearray/int with AttributeError instead of ProtocolError #2410
FTP.make's args branch (pcapkit/protocols/application/ftp.py) accepts Optional[str | bytes], but anything that isn't bytes falls through to args.encode(...). A bytearray, int, bool, or memoryview raises a bare AttributeError instead of a ProtocolError.
PR #2365 widened the sibling cmmd parameter to also accept bytearray (for the same reason #2290 treats a bare AttributeError there as a defect), but left args as it was — the gap predates #2365 and isn't new to it.
To Reproduce
frompcapkit.protocols.application.ftpimportFTPFTP(cmmd='USER', args=bytearray(b'anonymous'))
# AttributeError: 'bytearray' object has no attribute 'encode'
args=42, args=True, and args=memoryview(b'x') fail the same way. str and bytes work correctly (no regression there); cmmd=bytearray already works since #2365.
Expected behavior
Accept (bytes, bytearray) directly and .encode() only a str; anything else raises ProtocolError naming the argument, matching cmmd's current guard.
Additional context
Found and verified during this session's #1103 prose sweep (not the sweep's own scope — flagged for a dedicated fix). Widen the type annotation and Raises: docstring, and add a test alongside the existing cmmd coverage.
Activity
fix(ftp): reject arguments that are not str, bytes or bytearray (#2410)…