Merge pull request #7838 from gdicristofaro/CT-7336_noWarningForPlaceholder

CT-7336 updates for ignoring placeholder paths
This commit is contained in:
Mark McKinnon 2023-08-22 19:30:22 -04:00 committed by GitHub
commit e5860a7d51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 7 deletions

View File

@ -66,8 +66,8 @@ Case.open.msgDlg.updated.msg=Updated case database schema.\nA backup copy of the
Case.open.msgDlg.updated.title=Case Database Schema Update Case.open.msgDlg.updated.title=Case Database Schema Update
Case.checkImgExist.confDlg.doesntExist.msg=One of the images associated with \n\ Case.checkImgExist.confDlg.doesntExist.msg=One of the images associated with \n\
this case are missing. Would you like to search for them now?\n\ this case are missing. Would you like to search for them now?\n\
Previously, the image was located at:\n\ Previously, the image with host, {0}, was located at:\n\
{0}\n\ {1}\n\
Please note that you will still be able to browse directories and generate reports\n\ Please note that you will still be able to browse directories and generate reports\n\
if you choose No, but you will not be able to view file content or run the ingest process. if you choose No, but you will not be able to view file content or run the ingest process.
Case.checkImgExist.confDlg.doesntExist.title=Missing Image Case.checkImgExist.confDlg.doesntExist.title=Missing Image

View File

@ -253,8 +253,8 @@ Case.open.msgDlg.updated.msg=Updated case database schema.\nA backup copy of the
Case.open.msgDlg.updated.title=Case Database Schema Update Case.open.msgDlg.updated.title=Case Database Schema Update
Case.checkImgExist.confDlg.doesntExist.msg=One of the images associated with \n\ Case.checkImgExist.confDlg.doesntExist.msg=One of the images associated with \n\
this case are missing. Would you like to search for them now?\n\ this case are missing. Would you like to search for them now?\n\
Previously, the image was located at:\n\ Previously, the image with host, {0}, was located at:\n\
{0}\n\ {1}\n\
Please note that you will still be able to browse directories and generate reports\n\ Please note that you will still be able to browse directories and generate reports\n\
if you choose No, but you will not be able to view file content or run the ingest process. if you choose No, but you will not be able to view file content or run the ingest process.
Case.checkImgExist.confDlg.doesntExist.title=Missing Image Case.checkImgExist.confDlg.doesntExist.title=Missing Image

View File

@ -194,6 +194,8 @@ public class Case {
private final SleuthkitEventListener sleuthkitEventListener; private final SleuthkitEventListener sleuthkitEventListener;
private CollaborationMonitor collaborationMonitor; private CollaborationMonitor collaborationMonitor;
private Services caseServices; private Services caseServices;
// matches something like '\\.\PHYSICALDRIVE0'
private static final String PLACEHOLDER_DS_PATH_REGEX = "^\\s*\\\\\\\\\\.\\\\PHYSICALDRIVE\\d*\\s*$";
private volatile boolean hasDataSource = false; private volatile boolean hasDataSource = false;
private volatile boolean hasData = false; private volatile boolean hasData = false;
@ -1303,9 +1305,18 @@ public class Case {
for (Map.Entry<Long, String> entry : imgPaths.entrySet()) { for (Map.Entry<Long, String> entry : imgPaths.entrySet()) {
long obj_id = entry.getKey(); long obj_id = entry.getKey();
String path = entry.getValue(); String path = entry.getValue();
boolean fileExists = (new File(path).isFile() || DriveUtils.driveExists(path)); boolean fileExists = (new File(path).exists()|| DriveUtils.driveExists(path));
if (!fileExists) { if (!fileExists) {
// CT-7336: ignore relocating datasources if file provider is present and placeholder path is used.
if (newCurrentCase.getMetadata() != null
&& !StringUtils.isBlank(newCurrentCase.getMetadata().getContentProviderName())
&& (path == null || path.matches(PLACEHOLDER_DS_PATH_REGEX))) {
continue;
}
try { try {
DataSource ds = newCurrentCase.getSleuthkitCase().getDataSource(obj_id);
String hostName = StringUtils.defaultString(ds.getHost() == null ? "" : ds.getHost().getName());
// Using invokeAndWait means that the dialog will // Using invokeAndWait means that the dialog will
// open on the EDT but this thread will wait for an // open on the EDT but this thread will wait for an
// answer. Using invokeLater would cause this loop to // answer. Using invokeLater would cause this loop to
@ -1315,7 +1326,7 @@ public class Case {
public void run() { public void run() {
int response = JOptionPane.showConfirmDialog( int response = JOptionPane.showConfirmDialog(
mainFrame, mainFrame,
NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.msg", path), NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.msg", hostName, path),
NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.title"), NbBundle.getMessage(Case.class, "Case.checkImgExist.confDlg.doesntExist.title"),
JOptionPane.YES_NO_OPTION); JOptionPane.YES_NO_OPTION);
if (response == JOptionPane.YES_OPTION) { if (response == JOptionPane.YES_OPTION) {
@ -1327,7 +1338,7 @@ public class Case {
} }
}); });
} catch (InterruptedException | InvocationTargetException ex) { } catch (InterruptedException | InvocationTargetException | TskCoreException | TskDataException ex) {
logger.log(Level.SEVERE, "Failed to show missing image confirmation dialog", ex); //NON-NLS logger.log(Level.SEVERE, "Failed to show missing image confirmation dialog", ex); //NON-NLS
} }
} }