Skip to content

Commit 93b3406

Browse files
authored
Merge pull request #3411 from wschaeferB/3522-MultUserCasePathIsRealPath
3522 change case path used by Multi-User case panel to be real path i…
2 parents 4c11cb8 + 703cb9f commit 93b3406

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

Core/src/org/sleuthkit/autopsy/casemodule/CaseBrowser.java

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import org.openide.nodes.Node;
3030
import java.awt.EventQueue;
3131
import java.io.File;
32+
import java.io.IOException;
33+
import java.nio.file.LinkOption;
3234
import java.nio.file.Path;
3335
import java.nio.file.Paths;
3436
import java.util.ArrayList;
@@ -207,28 +209,34 @@ private List<CaseMetadata> getCases() throws CoordinationService.CoordinationSer
207209
List<String> nodeList = CoordinationService.getInstance().getNodeList(CoordinationService.CategoryNode.CASES);
208210

209211
for (String node : nodeList) {
210-
Path casePath = Paths.get(node);
211-
File caseFolder = casePath.toFile();
212-
if (caseFolder.exists()) {
213-
/*
214-
* Search for '*.aut' files.
215-
*/
216-
File[] fileArray = caseFolder.listFiles();
217-
if (fileArray == null) {
218-
continue;
219-
}
220-
String autFilePath = null;
221-
for (File file : fileArray) {
222-
String name = file.getName().toLowerCase();
223-
if (autFilePath == null && name.endsWith(".aut")) {
224-
try {
225-
caseList.add(new CaseMetadata(Paths.get(file.getAbsolutePath())));
226-
} catch (CaseMetadata.CaseMetadataException ex) {
227-
LOGGER.log(Level.SEVERE, String.format("Error reading case metadata file '%s'.", autFilePath), ex);
212+
Path casePath;
213+
try {
214+
casePath = Paths.get(node).toRealPath(LinkOption.NOFOLLOW_LINKS);
215+
216+
File caseFolder = casePath.toFile();
217+
if (caseFolder.exists()) {
218+
/*
219+
* Search for '*.aut' files.
220+
*/
221+
File[] fileArray = caseFolder.listFiles();
222+
if (fileArray == null) {
223+
continue;
224+
}
225+
String autFilePath = null;
226+
for (File file : fileArray) {
227+
String name = file.getName().toLowerCase();
228+
if (autFilePath == null && name.endsWith(".aut")) {
229+
try {
230+
caseList.add(new CaseMetadata(Paths.get(file.getAbsolutePath())));
231+
} catch (CaseMetadata.CaseMetadataException ex) {
232+
LOGGER.log(Level.SEVERE, String.format("Error reading case metadata file '%s'.", autFilePath), ex);
233+
}
234+
break;
228235
}
229-
break;
230236
}
231237
}
238+
} catch (IOException ignore) {
239+
//if a path could not be resolved to a real path do add it to the caseList
232240
}
233241
}
234242
return caseList;

0 commit comments

Comments
 (0)