sul-dlss / ocfl-rb

A ruby library for interacting with the Oxford Common File Layout (OCFL)
2 stars 0 forks source link

Avoid a nil-delegate error when the directory has not been initialized #47

Closed jcoyne closed 3 months ago

jcoyne commented 3 months ago

Otherwise we can see an error like this:

    Failure/Error: relative_path = ocfl_object.path(filepath: filename)

     ActionView::Template::Error:
       OCFL::Inventory#state delegated to head_version.state, but head_version is nil: #<OCFL::Inventory:0x000000010cdb0260 @data=#<OCFL::Inventory::InventoryStruct id="md919gh6774" type="https://ocfl.io/1.1/spec/#inventory" digestAlgorithm="sha512" head="v0" contentDirectory=nil versions={} manifest={}>>