nfdi4plants / ARCCommander

Tool to manage your ARCs
MIT License
11 stars 9 forks source link

[BUG] `arc a edit` fails with "could not parse query: ERROR: File was corrupted in Editor" #84

Closed omaus closed 2 years ago

omaus commented 2 years ago

Describe the bug When using arc a edit, filling out the new data, saving and exiting the editor, the console prints "could not parse query: ERROR: File was corrupted in Editor".

To Reproduce Steps to reproduce the behavior:

  1. Create new folder
  2. Open console in this folder with the ArcCommander available
  3. arc init
  4. arc i create -> Write some data of your choice
  5. arc a add-> Write some data of your choice
  6. arc a edit -> Access the newly created assay with the corresponding identifier and edit some data of your choice
  7. See error

Expected behavior Normal editing of the file.

OS and framework information (please complete the following information):

Additional context The problem already has been tracked down: It is the NewLine solution for bug #80, done in PR #81 which results in char '\013' (Carriage Return) being added to the end of each line. A deserialization of the string later fails due to incorrect pattern matching.
Solution: Add a String.replace to delete all the Carriage Returns. In non-Windows-OSs there won't be anything to replace which is no problem since the function only replaces those cases where it matches and doesn't fail if there's no matching case.