mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
Refactoring and minor changes
Signed-off-by: ZetaTom <70907959+ZetaTom@users.noreply.github.com>
This commit is contained in:
parent
761d37de01
commit
de1dcfe93a
2 changed files with 10 additions and 9 deletions
|
@ -235,7 +235,7 @@ class FileUploadWorker(
|
|||
}
|
||||
|
||||
private fun cleanupUploadProcess(result: RemoteOperationResult<Any?>, operation: UploadFileOperation) {
|
||||
if (operation.originalStoragePath.contains(operation.uploadedFilename)) {
|
||||
if (operation.decryptedRemotePath == operation.uploadedDecyptedRemotePath) {
|
||||
// TODO
|
||||
// This is not ideal fix. When uploading file to the encrypted folder server returns 404 FILE_NOT_FOUND
|
||||
// However file upload successfully completed. This fix mimic success, if upload successfully completed with
|
||||
|
|
|
@ -759,6 +759,10 @@ public class UploadFileOperation extends SyncOperation {
|
|||
result = new RemoteOperationResult(ResultCode.UNKNOWN_ERROR);
|
||||
}
|
||||
|
||||
if (result.isSuccess()) {
|
||||
setUploadedDecyptedRemotePath(mFile.getDecryptedRemotePath());
|
||||
}
|
||||
|
||||
logResult(result, mFile.getStoragePath(), mFile.getRemotePath());
|
||||
|
||||
// unlock must be done always
|
||||
|
@ -998,21 +1002,18 @@ public class UploadFileOperation extends SyncOperation {
|
|||
}
|
||||
}
|
||||
|
||||
private String uploadedFilename;
|
||||
private String uploadedDecyptedRemotePath;
|
||||
|
||||
public String getUploadedFilename(){
|
||||
return uploadedFilename;
|
||||
public String getUploadedDecyptedRemotePath(){
|
||||
return uploadedDecyptedRemotePath;
|
||||
}
|
||||
|
||||
public void setUploadedFilename(String uploadedFilename){
|
||||
this.uploadedFilename = uploadedFilename;
|
||||
public void setUploadedDecyptedRemotePath(String uploadedDecyptedRemotePath){
|
||||
this.uploadedDecyptedRemotePath = uploadedDecyptedRemotePath;
|
||||
}
|
||||
|
||||
private void logResult(RemoteOperationResult result, String sourcePath, String targetPath) {
|
||||
if (result.isSuccess()) {
|
||||
String filename = sourcePath.substring(sourcePath.lastIndexOf('/') + 1);
|
||||
setUploadedFilename(filename);
|
||||
|
||||
Log_OC.i(TAG, "Upload of " + sourcePath + " to " + targetPath + ": " + result.getLogMessage());
|
||||
} else {
|
||||
if (result.getException() != null) {
|
||||
|
|
Loading…
Reference in a new issue