Skip to content

Commit c039a5d

Browse files
feature/create-folder-during-upload: use new auto folder creation feature
Signed-off-by: daniele-verducci <daniele.verducci@nextcloud.com>
1 parent b6928a8 commit c039a5d

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

app/src/main/java/com/owncloud/android/operations/UploadFileOperation.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation;
5656
import com.owncloud.android.lib.resources.files.UploadFileRemoteOperation;
5757
import com.owncloud.android.lib.resources.files.model.RemoteFile;
58+
import com.owncloud.android.lib.resources.status.NextcloudVersion;
5859
import com.owncloud.android.lib.resources.status.OCCapability;
5960
import com.owncloud.android.operations.common.SyncOperation;
6061
import com.owncloud.android.operations.e2e.E2EClientData;
@@ -475,12 +476,15 @@ protected RemoteOperationResult run(OwnCloudClient client) {
475476
final boolean isResumingEncryptedUpload = (mFolderUnlockToken != null && !mFolderUnlockToken.isEmpty());
476477
if (!isResumingEncryptedUpload && (parent == null || mRemoteFolderToBeCreated)) {
477478
Log_OC.d(TAG, "verifying remote parent folder exists: " + remoteParentPath);
478-
final var result = grantFolderExistence(remoteParentPath, client);
479479

480-
if (!result.isSuccess()) {
481-
Log_OC.e(TAG, "grantFolderExistence failed for: " + remoteParentPath + ", code: " +
482-
result.getCode() + ", message: " + result.getMessage());
483-
return result;
480+
if (!getCapabilities().getVersion().isNewerOrEqual(NextcloudVersion.nextcloud_32)) {
481+
// No automatic folder creation before Nextcloud 32, create them
482+
final var result = grantFolderExistence(remoteParentPath, client);
483+
if (!result.isSuccess()) {
484+
Log_OC.e(TAG, "grantFolderExistence failed for: " + remoteParentPath + ", code: " +
485+
result.getCode() + ", message: " + result.getMessage());
486+
return result;
487+
}
484488
}
485489

486490
parent = getStorageManager().getFileByPath(remoteParentPath);

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
androidCommonLibraryVersion = "f46fb3b6789dee1f476269903da61e9b48c99587"
66
androidGifDrawableVersion = "1.2.32"
77
androidImageCropperVersion = "4.7.0"
8-
androidLibraryVersion ="d22a01f4b8327b6593d6af75f6be3aa7fbc2c854"
8+
androidLibraryVersion ="23b7bc1dbc7be64caf3bb00f06c9fa8b618ad144"
99
androidOpensslVersion = "3.5.6"
1010
androidPluginVersion = "9.4.0"
1111
androidsvgVersion = "1.4"

gradle/verification-metadata.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21169,6 +21169,14 @@
2116921169
<sha256 value="ced0eaec0b05aa707bf2e4f3481722532221dd0bee0d0a7e4c288bf9b0f5ca91" origin="Generated by Gradle" reason="Artifact is not signed"/>
2117021170
</artifact>
2117121171
</component>
21172+
<component group="com.github.nextcloud" name="android-library" version="23b7bc1dbc7be64caf3bb00f06c9fa8b618ad144">
21173+
<artifact name="android-library-23b7bc1dbc7be64caf3bb00f06c9fa8b618ad144.aar">
21174+
<sha256 value="f1e5006dba6b0b60466ef880e6c35aeea4bab265f9f843eff4045ed4f031d7d9" origin="Generated by Gradle"/>
21175+
</artifact>
21176+
<artifact name="android-library-23b7bc1dbc7be64caf3bb00f06c9fa8b618ad144.module">
21177+
<sha256 value="f751905158bc22a55af98cdd3aa484b0aab973e612f271514a0d3d58afd2b5ff" origin="Generated by Gradle"/>
21178+
</artifact>
21179+
</component>
2117221180
<component group="com.github.nextcloud" name="android-library" version="25bd90c0f21b9b16acee6a7f433063040c75f30d">
2117321181
<artifact name="android-library-25bd90c0f21b9b16acee6a7f433063040c75f30d.aar">
2117421182
<sha256 value="4fe766c7f7359013ed072d60062996dd98358c8a7ed8d90c71285c373ee23f12" origin="Generated by Gradle" reason="Artifact is not signed"/>

0 commit comments

Comments
 (0)