Skip to content

Commit

Permalink
Merge pull request #344 from lmagyar/pr-fix-virtual-folder-names
Browse files Browse the repository at this point in the history
Fix virtual folder names
  • Loading branch information
wolpi authored Jun 2, 2024
2 parents 82bb193 + 43c2350 commit e718e1b
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public abstract class VirtualFileSystemView<
RoSafType extends RoSafFile<MinaType>
> {

public static final String PREFIX_FS = "/fs";
public static final String PREFIX_ROOT = "/superuser";
public static final String PREFIX_SAF = "/saf";
public static final String PREFIX_ROSAF = "/rosaf";
public static final String PREFIX_FS = "fs";
public static final String PREFIX_ROOT = "superuser";
public static final String PREFIX_SAF = "saf";
public static final String PREFIX_ROSAF = "rosaf";

protected final Logger logger = LoggerFactory.getLogger(getClass());

Expand Down Expand Up @@ -48,28 +48,28 @@ public MinaType getFile(String file) {
logger.debug("getFile '{}', absolute: '{}'", file, absoluteVirtualPath);
if ("/".equals(absoluteVirtualPath)) {
return createFile(absoluteVirtualPath, null, true, pftpdService);
} else if (absoluteVirtualPath.startsWith(PREFIX_FS)) {
String realPath = toRealPath(absoluteVirtualPath, PREFIX_FS);
} else if (absoluteVirtualPath.startsWith("/" + PREFIX_FS)) {
String realPath = toRealPath(absoluteVirtualPath, "/" + PREFIX_FS);
logger.debug("Using FS '{}' for '{}'", realPath, absoluteVirtualPath);
if ("/".equals(realPath)) {
realPath = pftpdService.getPrefsBean().getStartDir().getAbsolutePath();
absoluteVirtualPath = PREFIX_FS + realPath;
absoluteVirtualPath = "/" + PREFIX_FS + realPath;
logger.debug(" switching to FS default dir: '{}'", absoluteVirtualPath);
}
AbstractFile delegate = fsFileSystemView.getFile(realPath);
return createFile(absoluteVirtualPath, delegate, pftpdService);
} else if (absoluteVirtualPath.startsWith(PREFIX_ROOT)) {
String realPath = toRealPath(absoluteVirtualPath, PREFIX_ROOT);
} else if (absoluteVirtualPath.startsWith("/" + PREFIX_ROOT)) {
String realPath = toRealPath(absoluteVirtualPath, "/" + PREFIX_ROOT);
logger.debug("Using ROOT '{}' for '{}'", realPath, absoluteVirtualPath);
AbstractFile delegate = rootFileSystemView.getFile(realPath);
return createFile(absoluteVirtualPath, delegate, pftpdService);
} else if (absoluteVirtualPath.startsWith(PREFIX_SAF)) {
String realPath = toRealPath(absoluteVirtualPath, PREFIX_SAF);
} else if (absoluteVirtualPath.startsWith("/" + PREFIX_SAF)) {
String realPath = toRealPath(absoluteVirtualPath, "/" + PREFIX_SAF);
logger.debug("Using SAF '{}' for '{}'", realPath, absoluteVirtualPath);
AbstractFile delegate = safFileSystemView.getFile(realPath);
return createFile(absoluteVirtualPath, delegate, pftpdService);
} else if (absoluteVirtualPath.startsWith(PREFIX_ROSAF)) {
String realPath = toRealPath(absoluteVirtualPath, PREFIX_ROSAF);
} else if (absoluteVirtualPath.startsWith("/" + PREFIX_ROSAF)) {
String realPath = toRealPath(absoluteVirtualPath, "/" + PREFIX_ROSAF);
logger.debug("Using ROSAF '{}' for '{}'", realPath, absoluteVirtualPath);
AbstractFile delegate = roSafFileSystemView.getFile(realPath);
return createFile(absoluteVirtualPath, delegate, pftpdService);
Expand Down

0 comments on commit e718e1b

Please sign in to comment.