mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
7050 fix results content viewer when artifacts content is not parent
This commit is contained in:
parent
ae9789d08b
commit
45d19ba585
@ -501,24 +501,37 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
Lookup lookup = selectedNode.getLookup();
|
Lookup lookup = selectedNode.getLookup();
|
||||||
|
|
||||||
// Get the content. We may get BlackboardArtifacts, ignore those here.
|
// Get the content. We may get BlackboardArtifacts, ignore those here.
|
||||||
ArrayList<BlackboardArtifact> artifacts = new ArrayList<>();
|
|
||||||
Collection<? extends Content> contents = lookup.lookupAll(Content.class);
|
Collection<? extends Content> contents = lookup.lookupAll(Content.class);
|
||||||
if (contents.isEmpty()) {
|
if (contents.isEmpty()) {
|
||||||
return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT);
|
return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT);
|
||||||
}
|
}
|
||||||
Content underlyingContent = null;
|
Content underlyingContent = null;
|
||||||
|
//find the first non-artifact content from the lookup results
|
||||||
for (Content content : contents) {
|
for (Content content : contents) {
|
||||||
if ((content != null) && (!(content instanceof BlackboardArtifact))) {
|
if ((content != null) && (!(content instanceof BlackboardArtifact))) {
|
||||||
// Get all of the blackboard artifacts associated with the content. These are what this
|
underlyingContent = content;
|
||||||
// viewer displays.
|
break;
|
||||||
try {
|
}
|
||||||
artifacts = content.getAllArtifacts();
|
}
|
||||||
underlyingContent = content;
|
ArrayList<BlackboardArtifact> contentArtifacts = new ArrayList<>();
|
||||||
break;
|
if (underlyingContent != null) {
|
||||||
} catch (TskException ex) {
|
try {
|
||||||
logger.log(Level.SEVERE, "Couldn't get artifacts", ex); //NON-NLS
|
//get the artifacts seperately for the use case where an artifact is about a file that exists other than its parent such as a TSK_WEB_DOWNLOAD or TSK_WEB_CACHE
|
||||||
return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT);
|
Collection<? extends BlackboardArtifact> nodeArtifacts = lookup.lookupAll(BlackboardArtifact.class);
|
||||||
|
if (!nodeArtifacts.isEmpty()) {
|
||||||
|
BlackboardArtifact originalArtifact = nodeArtifacts.iterator().next();
|
||||||
|
if (!underlyingContent.equals(originalArtifact.getParent())) {
|
||||||
|
contentArtifacts.add(originalArtifact);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (contentArtifacts.isEmpty()) {
|
||||||
|
// Get all of the blackboard artifacts associated with the content. These are what this
|
||||||
|
// viewer displays.
|
||||||
|
contentArtifacts = underlyingContent.getAllArtifacts();
|
||||||
|
}
|
||||||
|
} catch (TskException ex) {
|
||||||
|
logger.log(Level.SEVERE, "Couldn't get artifacts", ex); //NON-NLS
|
||||||
|
return new ViewUpdate(getArtifactContents().size(), currentPage, ERROR_TEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +541,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
|
|
||||||
// Build the new artifact contents cache.
|
// Build the new artifact contents cache.
|
||||||
ArrayList<BlackboardArtifact> artifactContents = new ArrayList<>();
|
ArrayList<BlackboardArtifact> artifactContents = new ArrayList<>();
|
||||||
for (BlackboardArtifact artifact : artifacts) {
|
for (BlackboardArtifact artifact : contentArtifacts) {
|
||||||
artifactContents.add(artifact);
|
artifactContents.add(artifact);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,7 +550,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
BlackboardArtifact artifact = lookup.lookup(BlackboardArtifact.class);
|
BlackboardArtifact artifact = lookup.lookup(BlackboardArtifact.class);
|
||||||
if (artifact != null) {
|
if (artifact != null) {
|
||||||
index = artifacts.indexOf(artifact);
|
index = contentArtifacts.indexOf(artifact);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
index = 0;
|
index = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -547,9 +560,9 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
|||||||
if (attr.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()) {
|
if (attr.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT.getTypeID()) {
|
||||||
long assocArtifactId = attr.getValueLong();
|
long assocArtifactId = attr.getValueLong();
|
||||||
int assocArtifactIndex = -1;
|
int assocArtifactIndex = -1;
|
||||||
for (BlackboardArtifact art : artifacts) {
|
for (BlackboardArtifact art : contentArtifacts) {
|
||||||
if (assocArtifactId == art.getArtifactID()) {
|
if (assocArtifactId == art.getArtifactID()) {
|
||||||
assocArtifactIndex = artifacts.indexOf(art);
|
assocArtifactIndex = contentArtifacts.indexOf(art);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user