bagit-python
bagit-python copied to clipboard
values passed to command line options lose line breaks
I'm trying to pass a string with newlines into the command line option for filling the External-Description metadata element, formatted nicely in accordance with the spec (https://tools.ietf.org/html/rfc8493#section-2.2.2), but because of #19 back in 2014, these newlines are getting stripped out and I cannot have a nicely wrapped bag-info.txt
file.
It seems that the behavior of bagit.py
is asymmetrical with respect to how it treats long tag lines: it handles folded lines when reading bag-info.txt
, but it does not fold long lines when writing long tag values into bag-info.txt
. This is hardwired into the function _make_tag_file(), which explicitly strips line endings from tag values before writing them (see line 1231).
I just did a PR for changes that implement a new flag, --wrap
. This change has been working for us in preliminary testing.