[sysadmin-bin: 1/2] Fix ftpadmin chocking on files without a newline at the end



commit 1fe43bd14ec12a702e80be311f7e755219374281
Author: Birger Schacht <birger rantanplan org>
Date:   Thu Mar 14 15:50:05 2019 +0100

    Fix ftpadmin chocking on files without a newline at the end
    
    readlines() expects a newline at the end of _every_ line,
    which is sometimes not the case with the last line in files.
    There is no need to have seperate lines as a list, so we can
    just use read().

 ftpadmin | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/ftpadmin b/ftpadmin
index ec81c75..8d11184 100755
--- a/ftpadmin
+++ b/ftpadmin
@@ -513,7 +513,7 @@ class TarInfo(BasicInfo):
                 size_files += info.size
 
                 if info.name in files:
-                    self.file[os.path.basename(info.name)] = t.extractfile(info).readlines()
+                    self.file[os.path.basename(info.name)] = t.extractfile(info).read()
 
                 if file_count == 1:
                     if '/' in info.name.lstrip('/'):


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