Explorar el Código

[native][fix] Ensure that even the last field is read in recfile records

jherve hace 1 año
padre
commit
c6933eabbe
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      native/src/job_search/job_storage.py

+ 3 - 1
native/src/job_search/job_storage.py

@@ -245,7 +245,9 @@ class JobStorage:
         for r in process.stdout.split("\n\n"):
             dict = {"skills": [], "tags": []}
 
-            lines = re.split(r"\n(?!\+)", r)[:-1]
+            # For some reason the last record always gets an extra line break which translates
+            # as an extra empty line in the split
+            lines = [l for l in re.split(r"\n(?!\+)", r) if l != ""]
             for l in lines:
                 # We assume fields are not empty
                 [field, value] = l.split(": ", 1)