public class BambooFilenameUtils extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
containsDirectoryTraversalString(String name)
Basic validation of a String to see if it contains directory traversal chars.
|
static boolean |
doesPathFollowToParentDirectory(String path)
Test if path "escapes" current directory
|
static String |
getScriptSuffix() |
static io.atlassian.fugue.Either<String,File> |
getShortWindowsPath(String path)
Returns a short 8.3 path for a given path.
|
static boolean |
isPathAbsolute(String path)
Test if path denotes absolute path
|
static String |
makeTempFileName(String prefix,
String suffix)
Creates a temp file name in prefix + random number + suffix format.
|
static File |
shortenNameIfPossible(File file)
Shortens name to 8.3 on Windows on best effort basis.
|
static String |
stripTrailingSlashes(String path)
Strip trailing slashes from path
|
public static boolean isPathAbsolute(String path)
path
- path to be verifiedpublic static boolean doesPathFollowToParentDirectory(String path)
path
- path to be verifiedpublic static String getScriptSuffix()
public static io.atlassian.fugue.Either<String,File> getShortWindowsPath(String path)
path
- path to convert to 8.3IllegalArgumentException
- if the input path does not exist@NotNull public static File shortenNameIfPossible(@NotNull File file)
@NotNull public static String makeTempFileName(@NotNull String prefix, @Nullable String suffix)
@Nullable public static String stripTrailingSlashes(@Nullable String path)
public static boolean containsDirectoryTraversalString(@Nullable String name)
BambooFileUtils.newFileUnderParent(File, String)
but can use when that is not practicalCopyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.