Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return 403 instead of 503 to resume syncing of desktop client #30059

Merged
merged 1 commit into from
Jan 11, 2018

Conversation

sharidas
Copy link
Contributor

@sharidas sharidas commented Jan 9, 2018

When 503 is returned the syncing is stopped
by desktop client. Hence its found better
to return 403.

Signed-off-by: Sujith H [email protected]

Description

Returning 503 was causing sync operation of desktop client to stop. Hence returning 403 makes sync operation not to stop.

Related Issue

#29794

Motivation and Context

When 503 is returned the sync operation is stopped by the desktop client. Hence 403 is being returned.

How Has This Been Tested?

Steps followed as mentioned in #29794.
The result captured from desktop client after applying the patch:

01-09 14:16:21:873 [ warning sync.networkjob ]: QNetworkReply::NetworkError(ContentOperationNotPermittedError) "Server replied \"403 Forbidden\" to \"GET http://localhost/testing/remote.php/dav/files/admin/welcome.txt\"" QVariant(int, 403)

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@sharidas sharidas self-assigned this Jan 9, 2018
@sharidas sharidas requested a review from PVince81 January 9, 2018 09:20
@sharidas sharidas added this to the development milestone Jan 9, 2018
@@ -226,6 +226,9 @@ function ($path) use ($storage) {
$this->assertInstanceOf($expectedException, $caughtException);
if ($checkPreviousClass) {
$this->assertInstanceOf(get_class($thrownException), $caughtException->getPrevious());
if (strpos(get_class($thrownException), "GenericEncryptionException") !== false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not assertInstanceOf with GenericEncryptionException::class ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why assertInstanceOf not used is because assert would fail if $thrownException is not of instance GenericEncryptionException . The @dataprovider https://github.com/owncloud/core/pull/30059/files/a650cd8f7c132a833072b98adb7846f1c092b81a#diff-9e251176dc475a2f3b02337f5288d2eaR119 provides other instances.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just provide the instance through the data provider then ?

I don't understand how or whether this line is even called.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PVince81 Updated the change by passing message also via data provider.

@codecov
Copy link

codecov bot commented Jan 10, 2018

Codecov Report

Merging #30059 into master will increase coverage by 0.09%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #30059      +/-   ##
============================================
+ Coverage     58.25%   58.34%   +0.09%     
- Complexity    18520    18596      +76     
============================================
  Files          1093     1093              
  Lines         63712    63980     +268     
============================================
+ Hits          37113    37329     +216     
- Misses        26599    26651      +52
Impacted Files Coverage Δ Complexity Δ
drone/src/lib/private/legacy/files.php 0% <0%> (ø) 66% <0%> (+4%) ⬆️
...src/apps/files_sharing/lib/API/OCSShareWrapper.php 0% <0%> (ø) 6% <0%> (ø) ⬇️
...rone/src/apps/files_sharing/lib/API/Share20OCS.php 95.21% <0%> (+3.59%) 221% <0%> (+72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 412f756...2ddad25. Read the comment docs.

@sharidas sharidas force-pushed the return403-encryption-for-client branch from a650cd8 to cdb9e53 Compare January 10, 2018 12:30
@@ -154,7 +154,9 @@ public function fopenFailuresProvider() {
],
[
new GenericEncryptionException(),
'Sabre\DAV\Exception\ServiceUnavailable'
'Sabre\DAV\Exception\ServiceUnavailable',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't this supposed to become a ForbiddenException ?

also in your previous changeset you had something like GenericEncryptionException ?

When 503 is returned the syncing is stopped
by desktop client. Hence its found better
to return 403.

Signed-off-by: Sujith H <[email protected]>
@sharidas sharidas force-pushed the return403-encryption-for-client branch from cdb9e53 to 2ddad25 Compare January 10, 2018 15:23
* @expectedException \Sabre\Dav\Exception\Forbidden
* @expectedExceptionMessage Encryption not ready
*/
public function testFopenForbiddenExceptionEncryption() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PVince81 Created a function to check the get() call making Forbidden exception. Earlier change set can be ignored.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sharidas sharidas merged commit 5ba286d into master Jan 11, 2018
@sharidas sharidas deleted the return403-encryption-for-client branch January 11, 2018 06:28
@sharidas
Copy link
Contributor Author

sharidas commented Jan 11, 2018

Added backport request so that we can backport this change after codefreeze. Let me know know if its ok to backport.

@phil-davis
Copy link
Contributor

Backport stable10 #30353
@sharidas I noticed this waiting, so made the backport PR to get CI happening.

@lock
Copy link

lock bot commented Aug 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants