Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Issue #214
  • Loading branch information
rsoika committed Sep 30, 2024
1 parent 2f96ae8 commit 65e99ad
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,9 @@ private String analyzeXMLContent(FileData fileData) {
* content.
* The Method returns an updated fileData object attached to the workitem even
* if the content was fetched from a Snapshot
*
* <p>
* If the file is no XML or a PDF without embedded XML the method returns null
*
* @param workitem The ItemCollection containing the attachments
* @param filePattern The pattern to match file names
* @return The XML content as a byte array, or null if not found
Expand All @@ -351,12 +353,17 @@ private FileData getXMLFileData(ItemCollection workitem, Pattern filePattern) th
FileData snapShotFileData = snapshotService.getWorkItemFile(workitem.getUniqueID(), filename);
fileContent = snapShotFileData.getContent();
}
byte[] xmlContent = fileContent;
byte[] xmlContent = null;
if (filePattern == PDF_PATTERN) {
xmlContent = getFirstEmbeddedXML(fileContent);
}
storeXMLContent(fileData, xmlContent);
return fileData;
if (filePattern == XML_PATTERN) {
xmlContent = fileContent;
}
if (xmlContent != null) {
storeXMLContent(fileData, xmlContent);
return fileData;
}
}
}
return null;
Expand Down

0 comments on commit 65e99ad

Please sign in to comment.