Skip to content

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

@nicolasfranck

Description

@nicolasfranck
$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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions