uhd-urz / elAPI

An extensible API client for eLabFTW
GNU Affero General Public License v3.0
5 stars 0 forks source link

eLabFTW does not recognize experiment format names in uppecase #33

Closed alexander-haller closed 2 months ago

alexander-haller commented 3 months ago

In GitLab by @mhxion on May 17, 2024, 13:45

Issue discovered by @alexander-haller: Running the following

$ elapi experiments get -i 1 -F ELN
INFO     Data with format 'ELN' cannot be shown on the terminal. Data will be exported.                                               cli.py:79
INFO     experiment_1 data successfully exported to /Users/<username>/Downloads/elapi/2024-05-17_132126_experiment_1.eln in ELN      export.py:71
         format.

and

$ cat /Users/<username>/Downloads/elapi/2024-05-17_132126_experiment_1.eln
{"code":400,"message":"Bad Request","description":"Incorrect format value."}%

Reason

eLabFTW doesn't recognize the format names (so all of them PDF, PDFA, ZIP, ZIPA, CSV, QRPNG, ELN) if the are in uppercase 🥲. In experiments plugin, elapi is just passing the format name as is to eLabFTW, so -F ELN fails because, ELN is passed as is to eLabFTW. Note: elAPI is still validating the format names first though. elapi will show an error message if invalid format names like -F foo is passed.

We just need to lowercase the format names before sending the request. But it's odd that eLab wants strictly lowercase!