fix: exist to also check files properly
This commit is contained in:
parent
42abae3a5a
commit
ad8d5338ca
@ -9,7 +9,7 @@ public enum PCloudApiErrorCodes {
|
|||||||
INVALID_DESTINATION(1037),
|
INVALID_DESTINATION(1037),
|
||||||
PROVIDE_URL(1040),
|
PROVIDE_URL(1040),
|
||||||
LOGIN_FAILED(2000),
|
LOGIN_FAILED(2000),
|
||||||
INVALID_FILE_FOLDER_NAME(2001),
|
INVALID_FILE_OR_FOLDER_NAME(2001),
|
||||||
COMPONENT_OF_PARENT_DIRECTORY_DOES_NOT_EXIST(2002),
|
COMPONENT_OF_PARENT_DIRECTORY_DOES_NOT_EXIST(2002),
|
||||||
ACCESS_DENIED(2003),
|
ACCESS_DENIED(2003),
|
||||||
FILE_OR_FOLDER_ALREADY_EXISTS(2004),
|
FILE_OR_FOLDER_ALREADY_EXISTS(2004),
|
||||||
@ -22,6 +22,7 @@ public enum PCloudApiErrorCodes {
|
|||||||
ACTIVE_SHARES_OR_SHAREREQUESTS_PRESENT(2028),
|
ACTIVE_SHARES_OR_SHAREREQUESTS_PRESENT(2028),
|
||||||
CANNOT_RENAME_ROOT_FOLDER(2042),
|
CANNOT_RENAME_ROOT_FOLDER(2042),
|
||||||
CANNOT_MOVE_FOLDER_INTO_SUBFOLDER_OF_ITSELF(2043),
|
CANNOT_MOVE_FOLDER_INTO_SUBFOLDER_OF_ITSELF(2043),
|
||||||
|
FILE_OR_FOLDER_NOT_FOUND(2055),
|
||||||
INVALID_ACCESS_TOKEN(2094),
|
INVALID_ACCESS_TOKEN(2094),
|
||||||
TOO_MANY_LOGIN_TRIES_FROM_IP(4000),
|
TOO_MANY_LOGIN_TRIES_FROM_IP(4000),
|
||||||
INTERNAL_ERROR(5000),
|
INTERNAL_ERROR(5000),
|
||||||
|
@ -43,10 +43,6 @@ import okio.Source;
|
|||||||
import static org.cryptomator.domain.usecases.cloud.Progress.progress;
|
import static org.cryptomator.domain.usecases.cloud.Progress.progress;
|
||||||
|
|
||||||
class PCloudImpl {
|
class PCloudImpl {
|
||||||
|
|
||||||
private static final int DIRECTORY_DOES_NOT_EXIST = 2005;
|
|
||||||
private static final int INVALID_FILE_OR_FOLDER_NAME = 2001;
|
|
||||||
|
|
||||||
private final PCloudClientFactory clientFactory = new PCloudClientFactory();
|
private final PCloudClientFactory clientFactory = new PCloudClientFactory();
|
||||||
private final PCloudCloud cloud;
|
private final PCloudCloud cloud;
|
||||||
private final RootPCloudFolder root;
|
private final RootPCloudFolder root;
|
||||||
@ -116,7 +112,9 @@ class PCloudImpl {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (ApiError e) {
|
} catch (ApiError e) {
|
||||||
if (e.errorCode() == DIRECTORY_DOES_NOT_EXIST || e.errorCode() == INVALID_FILE_OR_FOLDER_NAME) {
|
if (e.errorCode() == PCloudApiErrorCodes.DIRECTORY_DOES_NOT_EXIST.getValue()
|
||||||
|
|| e.errorCode() == PCloudApiErrorCodes.INVALID_FILE_OR_FOLDER_NAME.getValue()
|
||||||
|
|| e.errorCode() == PCloudApiErrorCodes.FILE_OR_FOLDER_NOT_FOUND.getValue()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user