From 8d6b48cc9f1114bab4876d21e8fb0adf8f807f2d Mon Sep 17 00:00:00 2001 From: Nell Hardcastle Date: Wed, 25 Mar 2026 09:03:47 -0700 Subject: [PATCH] fix(worker): Normalize crlf during annex object edits --- services/datalad/datalad_service/common/annex.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/datalad/datalad_service/common/annex.py b/services/datalad/datalad_service/common/annex.py index 85a66325b..97c587f2e 100644 --- a/services/datalad/datalad_service/common/annex.py +++ b/services/datalad/datalad_service/common/annex.py @@ -388,7 +388,10 @@ async def edit_annexed_file(path, expected_content, new_content, encoding='utf-8 real_path, 'r', encoding='utf-8', newline='' ) as annexed_file: annexed_file_contents = await annexed_file.read() - if expected_content != annexed_file_contents: + # Normalize only CRLF to LF before comparison + if expected_content.replace('\r\n', '\n') != annexed_file_contents.replace( + '\r\n', '\n' + ): raise EditAnnexedFileException('unexpected {path} content') # Open the working tree path to overwrite if path != real_path: