Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep speciale fields for bag-info.txt separate and refuse adding with method add_info #16

Open
nicolasfranck opened this issue Dec 19, 2019 · 0 comments

Comments

@nicolasfranck
Copy link
Contributor

$bagit->add_file( IO::File->new("myfile"), "r" );
$bagit->add_info( "Bag-Size",[]);
$bagit->write("mydirectory");

Bag-Size now reads:

Bag-Size: ARRAY(0x8993)

Explanation:

  • I added this special field Bag-Size after I added the file. This way Bag-Size is not overwritten, as _update_info is not triggered. If you do it in another order, then you won't get this situation.

  • Of course I should not add these kind of fields, but shouldn't these keys be disallowed? The method remove_info for example refuses to remove them:

https://github.com/LibreCat/Catmandu-BagIt/blob/master/lib/Catmandu/BagIt.pm#L654

  • Maybe keep these keys separate, outside of this info object, so no one has the ability to overwrite them accidentally as I did?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant