1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Fix build after rebasing with master

This commit is contained in:
davigonz 2020-01-17 11:13:21 +01:00
parent 03e30ae698
commit 4cd317d929

View File

@ -26,45 +26,16 @@ package com.owncloud.android.lib.resources.files;
import timber.log.Timber; import timber.log.Timber;
import java.io.File;
public class FileUtils { public class FileUtils {
public static final String PATH_SEPARATOR = "/"; public static final String PATH_SEPARATOR = "/";
public static final String FINAL_CHUNKS_FILE = ".file"; public static final String FINAL_CHUNKS_FILE = ".file";
/** static String getParentPath(String remotePath) {
* Validate the fileName to detect if contains any forbidden character: / , \ , < , > , String parentPath = new File(remotePath).getParent();
* : , " , | , ? , * parentPath = parentPath.endsWith(PATH_SEPARATOR) ? parentPath : parentPath + PATH_SEPARATOR;
*/ return parentPath;
public static boolean isValidName(String fileName, boolean versionSupportsForbiddenChars) {
boolean result = true;
Timber.d("fileName =======%s", fileName);
if ((versionSupportsForbiddenChars && fileName.contains(PATH_SEPARATOR)) ||
(!versionSupportsForbiddenChars && (fileName.contains(PATH_SEPARATOR) ||
fileName.contains("\\") || fileName.contains("<") || fileName.contains(">") ||
fileName.contains(":") || fileName.contains("\"") || fileName.contains("|") ||
fileName.contains("?") || fileName.contains("*")))) {
result = false;
}
return result;
}
/**
* Validate the path to detect if contains any forbidden character: \ , < , > , : , " , | ,
* ? , *
*/
public static boolean isValidPath(String path, boolean versionSupportsForbidenChars) {
boolean result = true;
Timber.d("path ....... %s", path);
if (!versionSupportsForbidenChars &&
(path.contains("\\") || path.contains("<") || path.contains(">") ||
path.contains(":") || path.contains("\"") || path.contains("|") ||
path.contains("?") || path.contains("*"))) {
result = false;
}
return result;
} }
/** /**