mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 19:14:55 +00:00
Merge branch 'develop' of https://github.com/sleuthkit/autopsy into substring_search_2384
This commit is contained in:
commit
32ef2bc03f
@ -346,14 +346,12 @@ final class LocalDiskPanel extends JPanel {
|
|||||||
|
|
||||||
String path = disk.getName();
|
String path = disk.getName();
|
||||||
|
|
||||||
// Remove all non-ASCII characters
|
// Remove any character that isn't alphanumeric, a space, parent, or underscore.
|
||||||
path = path.replaceAll("[^\\p{ASCII}]", ""); //NON-NLS
|
// If the name ends up empty or starting with a space, prepend "localDisk"
|
||||||
|
path = path.replaceAll("[^0-9A-Za-z _()]", ""); // NON-NLS
|
||||||
// Remove all control characters
|
if(path.isEmpty() || path.startsWith(" ")){
|
||||||
path = path.replaceAll("[\\p{Cntrl}]", ""); //NON-NLS
|
path = "localDisk" + path;
|
||||||
|
}
|
||||||
// Remove / \ : ? ' "
|
|
||||||
path = path.replaceAll("[/?:'\"\\\\]", ""); //NON-NLS
|
|
||||||
|
|
||||||
path += " " + System.currentTimeMillis();
|
path += " " + System.currentTimeMillis();
|
||||||
path += ".vhd";
|
path += ".vhd";
|
||||||
|
@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.directorytree;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.prefs.PreferenceChangeEvent;
|
import java.util.prefs.PreferenceChangeEvent;
|
||||||
@ -30,7 +29,6 @@ import javax.swing.AbstractAction;
|
|||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import org.openide.explorer.ExplorerManager;
|
import org.openide.explorer.ExplorerManager;
|
||||||
import org.openide.nodes.AbstractNode;
|
import org.openide.nodes.AbstractNode;
|
||||||
import org.openide.nodes.ChildFactory;
|
|
||||||
import org.openide.nodes.FilterNode;
|
import org.openide.nodes.FilterNode;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
import org.openide.nodes.Sheet;
|
import org.openide.nodes.Sheet;
|
||||||
@ -111,7 +109,7 @@ public class DataResultFilterNode extends FilterNode {
|
|||||||
* @param em ExplorerManager for component that is creating the node
|
* @param em ExplorerManager for component that is creating the node
|
||||||
*/
|
*/
|
||||||
public DataResultFilterNode(Node node, ExplorerManager em) {
|
public DataResultFilterNode(Node node, ExplorerManager em) {
|
||||||
super(node, Children.create(new DataResultFilterChildren(node, em), true));
|
super(node, new DataResultFilterChildren(node, em));
|
||||||
this.sourceEm = em;
|
this.sourceEm = em;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -122,7 +120,7 @@ public class DataResultFilterNode extends FilterNode {
|
|||||||
* @param em ExplorerManager for component that is creating the node
|
* @param em ExplorerManager for component that is creating the node
|
||||||
*/
|
*/
|
||||||
private DataResultFilterNode(Node node, ExplorerManager em, boolean filterKnown, boolean filterSlack) {
|
private DataResultFilterNode(Node node, ExplorerManager em, boolean filterKnown, boolean filterSlack) {
|
||||||
super(node, Children.create(new DataResultFilterChildren(node, em, filterKnown, filterSlack), true));
|
super(node, new DataResultFilterChildren(node, em, filterKnown, filterSlack));
|
||||||
this.sourceEm = em;
|
this.sourceEm = em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,20 +194,18 @@ public class DataResultFilterNode extends FilterNode {
|
|||||||
* DataResultFilterNode that created in the DataResultFilterNode.java.
|
* DataResultFilterNode that created in the DataResultFilterNode.java.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static class DataResultFilterChildren extends ChildFactory<Node> {
|
private static class DataResultFilterChildren extends FilterNode.Children {
|
||||||
|
|
||||||
private final ExplorerManager sourceEm;
|
private final ExplorerManager sourceEm;
|
||||||
|
|
||||||
private boolean filterKnown;
|
private boolean filterKnown;
|
||||||
private boolean filterSlack;
|
private boolean filterSlack;
|
||||||
private final Node parent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the constructor
|
* the constructor
|
||||||
*/
|
*/
|
||||||
private DataResultFilterChildren(Node arg, ExplorerManager sourceEm) {
|
private DataResultFilterChildren(Node arg, ExplorerManager sourceEm) {
|
||||||
super();
|
super(arg);
|
||||||
this.parent = arg;
|
|
||||||
switch (SelectionContext.getSelectionContext(arg)) {
|
switch (SelectionContext.getSelectionContext(arg)) {
|
||||||
case DATA_SOURCES:
|
case DATA_SOURCES:
|
||||||
filterSlack = filterSlackFromDataSources;
|
filterSlack = filterSlackFromDataSources;
|
||||||
@ -228,32 +224,23 @@ public class DataResultFilterNode extends FilterNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DataResultFilterChildren(Node arg, ExplorerManager sourceEm, boolean filterKnown, boolean filterSlack) {
|
private DataResultFilterChildren(Node arg, ExplorerManager sourceEm, boolean filterKnown, boolean filterSlack) {
|
||||||
super();
|
super(arg);
|
||||||
this.parent = arg;
|
|
||||||
this.filterKnown = filterKnown;
|
this.filterKnown = filterKnown;
|
||||||
this.filterSlack = filterSlack;
|
this.filterSlack = filterSlack;
|
||||||
this.sourceEm = sourceEm;
|
this.sourceEm = sourceEm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean createKeys(List<Node> list) {
|
protected Node[] createNodes(Node key) {
|
||||||
list.addAll(Arrays.asList(parent.getChildren().getNodes()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Node[] createNodesForKey(Node key) {
|
|
||||||
AbstractFile file = key.getLookup().lookup(AbstractFile.class);
|
AbstractFile file = key.getLookup().lookup(AbstractFile.class);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
if (filterKnown && (file.getKnown() == TskData.FileKnown.KNOWN)) {
|
if (filterKnown && (file.getKnown() == TskData.FileKnown.KNOWN)) {
|
||||||
// Filter out child nodes that represent known files
|
// Filter out child nodes that represent known files
|
||||||
return null;
|
return new Node[]{};
|
||||||
}
|
}
|
||||||
if (filterSlack && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
|
if (filterSlack && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
|
||||||
// Filter out child nodes that represent slack files
|
// Filter out child nodes that represent slack files
|
||||||
return null;
|
return new Node[]{};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Node[]{new DataResultFilterNode(key, sourceEm, filterKnown, filterSlack)};
|
return new Node[]{new DataResultFilterNode(key, sourceEm, filterKnown, filterSlack)};
|
||||||
@ -352,6 +339,7 @@ public class DataResultFilterNode extends FilterNode {
|
|||||||
return defaultVisit(fileTypes);
|
return defaultVisit(fileTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<Action> defaultVisit(DisplayableItemNode ditem) {
|
protected List<Action> defaultVisit(DisplayableItemNode ditem) {
|
||||||
//preserve the default node's actions
|
//preserve the default node's actions
|
||||||
@ -449,6 +437,8 @@ public class DataResultFilterNode extends FilterNode {
|
|||||||
return openChild(fileTypes);
|
return openChild(fileTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell the originating ExplorerManager to display the given
|
* Tell the originating ExplorerManager to display the given
|
||||||
* dataModelNode.
|
* dataModelNode.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user