Skip to content

Commit

Permalink
Merge pull request #3220 from keeps/cafonso-dev-eudorFix2
Browse files Browse the repository at this point in the history
Fixed problem with other metadata not supporting folders
  • Loading branch information
hmiguim authored Jun 7, 2024
2 parents a03d74a + b4a9cd4 commit 46629bd
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,22 +281,27 @@ private ReturnWithExceptions<Void, ModelObserver> indexRepresentation(final AIP
.listOtherMetadata(representation.getAipId(), representation.getId());

for (OptionalWithCause<OtherMetadata> otherMetadata : allOtherMetadata) {
if (otherMetadata.isPresent()) {
String suffix = otherMetadata.get().getFileSuffix();
String type = otherMetadata.get().getType();

String suffix = otherMetadata.get().getFileSuffix();
String type = otherMetadata.get().getType();
List<String> path = new ArrayList<>();
// suppose that all suffixes in othermetadata are like this
// ".metadata.<real_suffix>
String fileId = otherMetadata.get().getFileId();

// suppose that all suffixes in othermetadata are like this
// ".metadata.<real_suffix>
String fileId = otherMetadata.get().getFileId();
if (fileId.lastIndexOf(".") != -1) {
suffix = fileId.substring(fileId.lastIndexOf(".")) + suffix;
fileId = fileId.substring(0, fileId.lastIndexOf("."));
}
OtherMetadata om = model.retrieveOtherMetadata(aip.getId(), representation.getId(),
otherMetadata.get().getFileDirectoryPath(), fileId, suffix, type);

if (fileId.lastIndexOf(".") != -1) {
suffix = fileId.substring(fileId.lastIndexOf(".")) + suffix;
fileId = fileId.substring(0, fileId.lastIndexOf("."));
otherMetadataCreated(om);
} else {
LOGGER.error("Cannot index representation file", otherMetadata.getCause());
ret.add(otherMetadata.getCause());
}
OtherMetadata om = model.retrieveOtherMetadata(aip.getId(), representation.getId(), path, fileId, suffix, type);

otherMetadataCreated(om);
}

// TODO support safemode
Expand Down

0 comments on commit 46629bd

Please sign in to comment.