From 2de8646ba7cb968e1ac52f7546a64723352f7d42 Mon Sep 17 00:00:00 2001
From: Greg DiCristofaro <gregd@basistech.com>
Date: Tue, 22 Aug 2023 11:45:11 -0400
Subject: [PATCH] updates for ignoring placeholder paths

---
 Core/src/org/sleuthkit/autopsy/casemodule/Case.java | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java
index b1d2f28c31..57739bda76 100644
--- a/Core/src/org/sleuthkit/autopsy/casemodule/Case.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/Case.java
@@ -194,6 +194,8 @@ public class Case {
     private final SleuthkitEventListener sleuthkitEventListener;
     private CollaborationMonitor collaborationMonitor;
     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 hasData = false;
@@ -1305,6 +1307,13 @@ private static void updateGUIForCaseOpened(Case newCurrentCase) {
             String path = entry.getValue();
             boolean fileExists = (new File(path).isFile() || DriveUtils.driveExists(path));
             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 {
                     // Using invokeAndWait means that the dialog will
                     // open on the EDT but this thread will wait for an 
-- 
GitLab