Closed awoods closed 4 years ago
Cases like this are handled by configuring the repository to enforce path constraints:
For example:
var repo = new OcflRepositoryBuilder()
.layoutConfig(DefaultLayoutConfig.nTupleHashConfig())
.contentPathConstraintProcessor(DefaultContentPathConstraints.unix())
.storage(FileSystemOcflStorage.builder().repositoryRoot(repoDir).build())
.workDir(workDir)
.build();
I should probably rename that property to simply be contentPathConstraints
.
What is the result of configuring the repository with the DefaultContentPathConstraints.unix()
?
If you want to support long logical paths you need to define a custom PathSanitizer:
In this case it rejects logical paths up front that cannot be safely mapped directly to content paths. PathSanitizers provide a way to transform logical paths into safe content paths, but it's currently BYO.
I think this is resolved by #5. Currently, the only limitation that ocfl-java has on the length of ocfl object ids is based on the method used to map ids to object root directory paths. If the object id is used as the encapsulation directory, then object ids cannot be longer than 255 characters. Otherwise, the object id can be of any length.
The testing and surfacing of this limitation came through the script at the bottom run against a Fedora 6 repository. The issue, which may potentially require no additional action beyond documenting in the README what the limitation is for file lengths on Ubuntu, is that files with names with 323 characters fails when persisting to OCFL. I have not narrowed down the exact limitation length.
Testing script
Script output