Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit e6f3fd2

Browse files
committed
Upload workers and network operations adapted to spaces
1 parent a395787 commit e6f3fd2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/files/UploadFileFromFileSystemOperation.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ownCloud Android Library is available under MIT license
2-
* Copyright (C) 2022 ownCloud GmbH.
2+
* Copyright (C) 2023 ownCloud GmbH.
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -48,13 +48,15 @@ import java.util.concurrent.atomic.AtomicBoolean
4848
* @author masensio
4949
* @author David González Verdugo
5050
* @author Abel García de Prada
51+
* @author Juan Carlos Garrote Gascón
5152
*/
5253
open class UploadFileFromFileSystemOperation(
5354
val localPath: String,
5455
val remotePath: String,
5556
val mimeType: String,
5657
val lastModifiedTimestamp: String,
5758
val requiredEtag: String?,
59+
val spaceWebDavUrl: String? = null,
5860
) : RemoteOperation<Unit>() {
5961

6062
protected val cancellationRequested = AtomicBoolean(false)
@@ -97,7 +99,8 @@ open class UploadFileFromFileSystemOperation(
9799
synchronized(dataTransferListener) { it.addDatatransferProgressListeners(dataTransferListener) }
98100
}
99101

100-
putMethod = PutMethod(URL(client.userFilesWebDavUri.toString() + WebdavUtils.encodePath(remotePath)), fileRequestBody!!).apply {
102+
val baseStringUrl = spaceWebDavUrl ?: client.userFilesWebDavUri.toString()
103+
putMethod = PutMethod(URL(baseStringUrl + WebdavUtils.encodePath(remotePath)), fileRequestBody!!).apply {
101104
retryOnConnectionFailure = false
102105
if (!requiredEtag.isNullOrBlank()) {
103106
addRequestHeader(HttpConstants.IF_MATCH_HEADER, requiredEtag)

0 commit comments

Comments
 (0)