From 13ee691133033c9d5e49eb1fa742ffa8d6a05f2e Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 11 Mar 2019 14:30:43 +0100 Subject: [PATCH] Banktransfer: CSV import of Mac CSV files --- src/pretix/plugins/banktransfer/csvimport.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pretix/plugins/banktransfer/csvimport.py b/src/pretix/plugins/banktransfer/csvimport.py index 6f570b4c8a..611083844f 100644 --- a/src/pretix/plugins/banktransfer/csvimport.py +++ b/src/pretix/plugins/banktransfer/csvimport.py @@ -46,6 +46,10 @@ def get_rows_from_file(file): except ImportError: charset = file.charset data = data.decode(charset or 'utf-8') + # If the file was modified on a Mac, it only contains \r as line breaks + if '\r' in data and '\n' not in data: + data = data.replace('\r', '\n') + # Sniffing line by line is necessary as some banks like to include # one-column garbage at the beginning of the file which breaks the sniffer. # See also: http://bugs.python.org/issue2078