[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Default compression attribute to plaintext



commit 0519cf57fcfe54de71956d7127bd8551ede2dfac
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Jul 28 14:27:31 2019 -0700

    Default compression attribute to plaintext
    
    Unrecognized file extensions should be treated as being uncompressed. For
    instance, if CollecTor includes a json file we want to download it as-is
    (rather than choke on an unexpected None value).
---
 stem/descriptor/collector.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/stem/descriptor/collector.py b/stem/descriptor/collector.py
index 69425dd5..d1c90e0e 100644
--- a/stem/descriptor/collector.py
+++ b/stem/descriptor/collector.py
@@ -314,12 +314,11 @@ class File(object):
     Determine file comprssion from CollecTor's filename.
     """
 
-    if '.' not in path or path.endswith('.tar'):
-      return Compression.PLAINTEXT
-    else:
-      for compression in (Compression.LZMA, Compression.BZ2, Compression.GZIP):
-        if path.endswith(compression.extension):
-          return compression
+    for compression in (Compression.LZMA, Compression.BZ2, Compression.GZIP):
+      if path.endswith(compression.extension):
+        return compression
+
+    return Compression.PLAINTEXT
 
   @staticmethod
   def _guess_time_range(path):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits