From 829c8fca962b32b9536f3da069d30a6356ad8b2f Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 31 Dec 2023 17:20:45 +0000 Subject: [PATCH] curl/CLI-friendly 403/404 --- copyparty/httpcli.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index b8feda96..287c64ca 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -3363,11 +3363,19 @@ class HttpCli(object): rc = 404 if self.args.vague_403: t = '

404 not found  ┐( ´ -`)┌

or maybe you don\'t have access -- try logging in or go home

' + pt = "404 not found ┐( ´ -`)┌ (or maybe you don't have access -- try logging in)" elif is_403: t = '

403 forbiddena  ~┻━┻

you\'ll have to log in or go home

' + pt = "403 forbiddena ~┻━┻ (you'll have to log in)" rc = 403 else: t = '

404 not found  ┐( ´ -`)┌

go home

' + pt = "404 not found ┐( ´ -`)┌" + + if self.ua.startswith("curl/") or self.ua.startswith("fetch"): + pt = "# acct: %s\n%s" % (self.uname, pt) + self.reply(pt.encode("utf-8"), status=rc) + return True t = t.format(self.args.SR) qv = quotep(self.vpaths) + self.ourlq()