diff --git a/newsfragments/742.bugfix b/newsfragments/742.bugfix new file mode 100644 index 000000000..dfcb2b06e --- /dev/null +++ b/newsfragments/742.bugfix @@ -0,0 +1,2 @@ +``FormatCBFMini``: when parsing header lines for a timestamp, avoid clashes with Windows paths. + diff --git a/src/dxtbx/format/FormatCBFMini.py b/src/dxtbx/format/FormatCBFMini.py index 8e24f1808..4947fecd3 100644 --- a/src/dxtbx/format/FormatCBFMini.py +++ b/src/dxtbx/format/FormatCBFMini.py @@ -82,7 +82,11 @@ def _get_timestamp_from_raw_header( header = header.splitlines() timestamp = None for record in header: - if len(record[1:].split()) <= 2 and record.count(":") == 2: + if ( + len(record[1:].split()) <= 2 + and record.count(":") == 2 + and "Image_path" not in record + ): timestamp = datetime.datetime.fromisoformat(record[1:].strip()) break return timestamp @@ -100,7 +104,11 @@ def _start(self): if record[:1] != "#": continue - if len(record[1:].split()) <= 2 and record.count(":") == 2: + if ( + len(record[1:].split()) <= 2 + and record.count(":") == 2 + and "Image_path" not in record + ): self._cif_header_dictionary["timestamp"] = record[1:].strip() continue