Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ownCloud admins and users.

## Summary

* Bugfix - Handling of HTTP code response 413: [#4094](https://github.com/owncloud/android/issues/4094)
* Bugfix - Set authorization header for token request only when necessary: [#4575](https://github.com/owncloud/android/issues/4575)
* Bugfix - Add explicit permission to Detekt workflow: [#4675](https://github.com/owncloud/android/pull/4675)
* Change - SBOM workflow runs on dependabot PRs: [#4664](https://github.com/owncloud/android/pull/4664)
Expand All @@ -51,6 +52,14 @@ ownCloud admins and users.

## Details

* Bugfix - Handling of HTTP code response 413: [#4094](https://github.com/owncloud/android/issues/4094)

A new exception has been added to handle cases where the payload exceeds the
server limit (HTTP code 413)

https://github.com/owncloud/android/issues/4094
https://github.com/owncloud/android/pull/4685

* Bugfix - Set authorization header for token request only when necessary: [#4575](https://github.com/owncloud/android/issues/4575)

A new field has been added to the token request to indicate whether the
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/4685
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Handling of HTTP code response 413

A new exception has been added to handle cases where the payload exceeds the server limit (HTTP code 413)

https://github.com/owncloud/android/issues/4094
https://github.com/owncloud/android/pull/4685
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* ownCloud Android client application
*
* @author Juan Carlos Garrote Gascón
* @author Jorge Aguado Recio
*
* Copyright (C) 2022 ownCloud GmbH.
* Copyright (C) 2025 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -49,6 +50,7 @@ fun OCTransfer.statusToStringRes(): Int =
TransferResult.QUOTA_EXCEEDED -> R.string.failed_upload_quota_exceeded_text
TransferResult.SSL_RECOVERABLE_PEER_UNVERIFIED -> R.string.ssl_certificate_not_trusted
TransferResult.UNKNOWN -> R.string.uploads_view_upload_status_unknown_fail
TransferResult.FILE_TOO_LARGE -> R.string.uploads_view_upload_status_failed_payload_error
// Should not get here; cancelled uploads should be wiped out
TransferResult.CANCELLED -> R.string.uploads_view_upload_status_cancelled
// Should not get here; status should be UPLOAD_SUCCESS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
* ownCloud Android client application
*
* @author David González Verdugo
* Copyright (C) 2020 ownCloud GmbH.
* @author Jorge Aguado Recio
*
* Copyright (C) 2025 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -41,6 +43,7 @@ import com.owncloud.android.domain.exceptions.NoConnectionWithServerException
import com.owncloud.android.domain.exceptions.NoNetworkConnectionException
import com.owncloud.android.domain.exceptions.OAuth2ErrorAccessDeniedException
import com.owncloud.android.domain.exceptions.OAuth2ErrorException
import com.owncloud.android.domain.exceptions.PayloadTooLongException
import com.owncloud.android.domain.exceptions.QuotaExceededException
import com.owncloud.android.domain.exceptions.RedirectToNonSecureException
import com.owncloud.android.domain.exceptions.ResourceLockedException
Expand Down Expand Up @@ -100,6 +103,7 @@ fun Throwable.parseError(
is UnauthorizedException -> resources.getString(R.string.auth_unauthorized)
is NetworkErrorException -> resources.getString(R.string.network_error_message)
is ResourceLockedException -> resources.getString(R.string.resource_locked_error_message)
is PayloadTooLongException -> resources.getString(R.string.uploads_view_upload_status_failed_payload_error)
else -> resources.getString(R.string.common_error_unknown)
}

Expand Down
1 change: 1 addition & 0 deletions owncloudApp/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
<string name="uploads_view_upload_status_failed_localfile_error">Local file not found</string>
<string name="uploads_view_upload_status_failed_permission_error">Permission error</string>
<string name="uploads_view_upload_status_failed_firewall_error">Forbidden due to a firewall rule</string>
<string name="uploads_view_upload_status_failed_payload_error">File too large for upload</string>
<string name="uploads_view_upload_status_conflict">Conflict</string>
<string name="uploads_view_upload_status_service_interrupted">App was terminated</string>
<string name="uploads_view_upload_status_unknown_fail">Unknown error</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ public RemoteOperationResult(HttpBaseMethod httpMethod) throws IOException {
case HttpConstants.HTTP_TOO_EARLY:
mCode = ResultCode.TOO_EARLY;
break;
case HttpConstants.HTTP_REQUEST_TOO_LONG:
mCode = ResultCode.PAYLOAD_TOO_LONG;
break;
default:
break;
}
Expand Down Expand Up @@ -596,6 +599,7 @@ public enum ResultCode {
SPECIFIC_BAD_REQUEST,
TOO_EARLY,
NETWORK_ERROR,
RESOURCE_LOCKED
RESOURCE_LOCKED,
PAYLOAD_TOO_LONG
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
*
* @author David González Verdugo
* @author Juan Carlos Garrote Gascón
* @author Jorge Aguado Recio
*
* Copyright (C) 2022 ownCloud GmbH.
* Copyright (C) 2025 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -51,6 +52,7 @@ import com.owncloud.android.domain.exceptions.OAuth2ErrorAccessDeniedException
import com.owncloud.android.domain.exceptions.OAuth2ErrorException
import com.owncloud.android.domain.exceptions.PartialCopyDoneException
import com.owncloud.android.domain.exceptions.PartialMoveDoneException
import com.owncloud.android.domain.exceptions.PayloadTooLongException
import com.owncloud.android.domain.exceptions.QuotaExceededException
import com.owncloud.android.domain.exceptions.RedirectToNonSecureException
import com.owncloud.android.domain.exceptions.ResourceLockedException
Expand Down Expand Up @@ -143,6 +145,7 @@ private fun <T> handleRemoteOperationResult(
RemoteOperationResult.ResultCode.TOO_EARLY -> throw TooEarlyException()
RemoteOperationResult.ResultCode.NETWORK_ERROR -> throw NetworkErrorException()
RemoteOperationResult.ResultCode.RESOURCE_LOCKED -> throw ResourceLockedException()
RemoteOperationResult.ResultCode.PAYLOAD_TOO_LONG -> throw PayloadTooLongException()
else -> throw Exception("An unknown error has occurred")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* ownCloud Android client application
*
* @author Jorge Aguado Recio
*
* Copyright (C) 2025 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.owncloud.android.domain.exceptions

class PayloadTooLongException : Exception()
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* ownCloud Android client application
*
* @author Juan Carlos Garrote Gascón
* @author Jorge Aguado Recio
*
* Copyright (C) 2022 ownCloud GmbH.
* Copyright (C) 2025 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand All @@ -26,6 +27,7 @@ import com.owncloud.android.domain.exceptions.ForbiddenException
import com.owncloud.android.domain.exceptions.LocalFileNotFoundException
import com.owncloud.android.domain.exceptions.NetworkErrorException
import com.owncloud.android.domain.exceptions.NoConnectionWithServerException
import com.owncloud.android.domain.exceptions.PayloadTooLongException
import com.owncloud.android.domain.exceptions.QuotaExceededException
import com.owncloud.android.domain.exceptions.SSLRecoverablePeerUnverifiedException
import com.owncloud.android.domain.exceptions.ServiceUnavailableException
Expand All @@ -52,7 +54,8 @@ enum class TransferResult constructor(val value: Int) {
SSL_RECOVERABLE_PEER_UNVERIFIED(value = 13),
SPECIFIC_FORBIDDEN(value = 14),
SPECIFIC_SERVICE_UNAVAILABLE(value = 15),
SPECIFIC_UNSUPPORTED_MEDIA_TYPE(value = 16);
SPECIFIC_UNSUPPORTED_MEDIA_TYPE(value = 16),
FILE_TOO_LARGE(value = 17);

companion object {
fun fromValue(value: Int): TransferResult =
Expand All @@ -74,6 +77,7 @@ enum class TransferResult constructor(val value: Int) {
14 -> SPECIFIC_FORBIDDEN
15 -> SPECIFIC_SERVICE_UNAVAILABLE
16 -> SPECIFIC_UNSUPPORTED_MEDIA_TYPE
17 -> FILE_TOO_LARGE
else -> UNKNOWN
}

Expand All @@ -94,6 +98,7 @@ enum class TransferResult constructor(val value: Int) {
is QuotaExceededException -> QUOTA_EXCEEDED
is SpecificUnsupportedMediaTypeException -> SPECIFIC_UNSUPPORTED_MEDIA_TYPE
is SSLRecoverablePeerUnverifiedException -> SSL_RECOVERABLE_PEER_UNVERIFIED
is PayloadTooLongException -> FILE_TOO_LARGE
else -> UNKNOWN
}
}
Expand Down
Loading