From 12b731783138192071b3803f18822f72a8df053f Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 15 Sep 2021 00:18:58 +0200 Subject: [PATCH] wget: delete url file --- bin/mtag/wget.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/mtag/wget.py b/bin/mtag/wget.py index 623e9b3b..f3f8934e 100644 --- a/bin/mtag/wget.py +++ b/bin/mtag/wget.py @@ -25,7 +25,7 @@ from urllib.parse import unquote_to_bytes as unquote def main(): - fp = sys.argv[1] + fp = os.path.abspath(sys.argv[1]) fdir = os.path.dirname(fp) fname = os.path.basename(fp) if not fname.startswith("put-") or not fname.endswith(".bin"): @@ -65,6 +65,10 @@ def main(): try: sp.check_call(cmd) + + # OPTIONAL: + # on success, delete the .bin file which contains the URL + os.unlink(fp) except: open("-- FAILED TO DONWLOAD " + name, "wb").close()