Skip to content
Snippets Groups Projects
Commit 1d6bc98a authored by Thorsten Vitt's avatar Thorsten Vitt
Browse files

Don't 500 when generating a name for an empty result.

Refs #22310
parent 81f6aa62
No related branches found
No related tags found
No related merge requests found
......@@ -403,9 +403,11 @@ private String calculateFilename() throws MetadataParseFault, ObjectNotFoundFaul
final StringBuilder result = new StringBuilder(title.length() + 30);
result.append(DefaultFilenamePolicy.INSTANCE.translate(title));
Iterator<ObjectType> roots = getRootObjects().iterator();
ObjectType first = roots.next();
if (!roots.hasNext())
result.append('.').append(URI.create(first.getGeneric().getGenerated().getTextgridUri().getValue()).getSchemeSpecificPart());
if (roots.hasNext()) {
ObjectType first = roots.next();
if (!roots.hasNext())
result.append('.').append(URI.create(first.getGeneric().getGenerated().getTextgridUri().getValue()).getSchemeSpecificPart());
}
if (fileExtension != null && !fileExtension.isEmpty())
result.append('.').append(fileExtension);
return result.toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment