Skip to content

SmbFile.getDfsPath() returns incorrect server before connecting #2

@jblesener

Description

@jblesener

If you call getDfsPath() on a SmbFile object before calling any method that accesses the file, like exists(), you will get an incorrect result. If you call getDfsPath() after accessing the file, you will get the correct result.

Only tested on files accessed through a domain DFS namespace, not server DFS namespace.

This code will replicate the issue:
String filePath = "smb://domain.name/dfspath1/dfspath2";

SmbFile dfsFile = new SmbFile(filePath);

System.out.println("Initial Path: " + filePath); //prints smb://domain.name/dfspath1/dfspath2
System.out.println("DFS Path: " + dfsFile.getDfsPath()); //prints smb://dfsnameserver/dfspath1/dfspath2, only the server name changes and it is technically still a valid path but not what the function should return
System.out.println("Exists: " + dfsFile.exists());
System.out.println("DFS Path, try 2: " + dfsFile.getDfsPath()); //prints smb://fileserver/share/path

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions