From 2846a18ab3d9eada9d52702ae692591e16f02163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20MANSUY?= Date: Thu, 4 Dec 2025 19:18:36 +0800 Subject: [PATCH] cherry-pick f5558240 --- lightrag/utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lightrag/utils.py b/lightrag/utils.py index cf585016..959607e5 100644 --- a/lightrag/utils.py +++ b/lightrag/utils.py @@ -2629,9 +2629,9 @@ def fix_tuple_delimiter_corruption( record, ) - # Fix: -> <|#|>, <|#|Y> -> <|#|>, -> <|#|>, <||#||> -> <|#|>, <||#> -> <|#|> (one extra characters outside pipes) + # Fix: -> <|#|>, <|#|Y> -> <|#|>, -> <|#|>, <||#||> -> <|#|> (one extra characters outside pipes) record = re.sub( - rf"<.?\|{escaped_delimiter_core}\|*?>", + rf"<.?\|{escaped_delimiter_core}\|.?>", tuple_delimiter, record, ) @@ -2651,7 +2651,6 @@ def fix_tuple_delimiter_corruption( ) # Fix: <|#| -> <|#|>, <|#|| -> <|#|> (missing closing >) - record = re.sub( rf"<\|{escaped_delimiter_core}\|+(?!>)", tuple_delimiter, @@ -2665,6 +2664,13 @@ def fix_tuple_delimiter_corruption( record, ) + # Fix: <||#> -> <|#|> (double pipe at start, missing pipe at end) + record = re.sub( + rf"<\|+{escaped_delimiter_core}>", + tuple_delimiter, + record, + ) + # Fix: <|| -> <|#|> record = re.sub( r"<\|\|(?!>)",