From 97ff0ebd061a14f05cd57d82955a7d397ffb39e3 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 15 Nov 2022 20:16:41 +0000 Subject: [PATCH] xz-compress logs only if -lo ends with .xz --- copyparty/svchub.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/copyparty/svchub.py b/copyparty/svchub.py index e864d898..85adb781 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -346,10 +346,12 @@ class SvcHub(object): fn = sel_fn try: - import lzma - - lh = lzma.open(fn, "wt", encoding="utf-8", errors="replace", preset=0) + if fn.lower().endswith(".xz"): + import lzma + lh = lzma.open(fn, "wt", encoding="utf-8", errors="replace", preset=0) + else: + lh = open(fn, "wt", encoding="utf-8", errors="replace") except: import codecs