Fix by Alper

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
Jonas Mayer 2024-04-02 10:52:14 +02:00 committed by Alper Öztürk
parent 807a865da0
commit b834d9c4a5
6 changed files with 18 additions and 19 deletions

View File

@ -115,8 +115,12 @@ class OfflineSyncWork constructor(
* @return new etag if changed, `null` otherwise
*/
private fun checkEtagChanged(folderName: String, storageManager: FileDataStorageManager, user: User): String? {
val ocFolder = storageManager.getFileByPath(folderName)
Log_OC.d(TAG, folderName + ": currentEtag: " + ocFolder.etag)
val ocFolder = storageManager.getFileByPath(folderName) ?: return null
ocFolder.etag?.let {
Log_OC.d(TAG, "$folderName: currentEtag: $it")
}
// check for etag change, if false, skip
val checkEtagOperation = CheckEtagRemoteOperation(
ocFolder.remotePath,

View File

@ -49,9 +49,9 @@ class FileDownloadHelper {
val fileStorageManager = FileDataStorageManager(user, MainApp.getAppContext().contentResolver)
val topParentId = fileStorageManager.getTopParentId(file)
return if (file.isFolder) {
backgroundJobManager.isStartFileDownloadJobScheduled(user, file.fileId) ||
backgroundJobManager.isStartFileDownloadJobScheduled(user, topParentId)
val isJobScheduled = backgroundJobManager.isStartFileDownloadJobScheduled(user, file.fileId)
return isJobScheduled || if (file.isFolder) {
backgroundJobManager.isStartFileDownloadJobScheduled(user, topParentId)
} else {
FileDownloadWorker.isDownloading(user.accountName, file.fileId)
}

View File

@ -361,15 +361,6 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
return false;
}
public String getFileNameWithoutExtension(String fileName) {
int dotIndex = fileName.lastIndexOf('.');
if (dotIndex > 0) {
return fileName.substring(0, dotIndex);
} else {
return fileName;
}
}
/**
* The path, where the file is stored locally
*

View File

@ -273,7 +273,13 @@ public class DownloadFileOperation extends RemoteOperation {
}
}
if (downloadType == DownloadType.EXPORT) {
if (downloadType == DownloadType.DOWNLOAD && !file.isEncrypted()) {
moved = tmpFile.renameTo(newFile);
newFile.setLastModified(file.getModificationTimestamp());
if (!moved) {
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED);
}
} else if (downloadType == DownloadType.EXPORT) {
new FileExportUtils().exportFile(file.getFileName(),
file.getMimeType(),
operationContext.getContentResolver(),

View File

@ -726,7 +726,7 @@ public class UploadFileOperation extends SyncOperation {
metadata,
token,
client,
metadataExists,
true,
mContext,
user,
getStorageManager());

View File

@ -106,11 +106,9 @@ public class RemoveFilesDialogFragment extends ConfirmationDialogFragment implem
if (containsFolder || containsDown) {
args.putInt(ARG_NEGATIVE_BTN_RES, R.string.confirmation_remove_local);
args.putInt(ARG_NEUTRAL_BTN_RES, R.string.file_keep);
} else {
args.putInt(ARG_NEGATIVE_BTN_RES, R.string.file_keep);
}
args.putInt(ARG_NEUTRAL_BTN_RES, R.string.file_keep);
args.putParcelableArrayList(ARG_TARGET_FILES, files);
frag.setArguments(args);