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

fix: use error detail as message instead of whole error object #6911

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

saw-jan
Copy link
Member

@saw-jan saw-jan commented Jul 28, 2023

Description

Whenever the file preview requests fail with 400 Bad Request, full error object was returned as error message for the webdav response. For example (try to get folder preview);

curl "https://localhost:9200/remote.php/dav/files/admin/folder?x=32&y=32&forceIcon=0&preview=1" \
-uadmin:admin -vk

Current,

...
< HTTP/1.1 400 Bad Request
...

<?xml version="1.0" encoding="UTF-8"?>
<d:error
	xmlns:d="DAV"
	xmlns:s="http://sabredav.org/ns">
	<s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
	<s:message>{"id":"com.owncloud.api.thumbnails","code":400,"detail":"Unsupported file type","status":"Bad Request"}</s:message>
</d:error>

This PR fixes the redundancy in the error message and only return detail from the error object.

With PR,

...
	<s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
	<s:message>Unsupported file type</s:message>
...

Related Issue

Motivation and Context

return proper error message in the response

How Has This Been Tested?

  • local
  • CI

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)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@saw-jan saw-jan self-assigned this Jul 28, 2023
@saw-jan saw-jan requested review from 2403905 and kobergj July 28, 2023 04:24
@owncloud owncloud deleted a comment from update-docs bot Jul 28, 2023
@saw-jan
Copy link
Member Author

saw-jan commented Jul 28, 2023

@kobergj @2403905 Here is another one

@saw-jan
Copy link
Member Author

saw-jan commented Jul 28, 2023

Copy link
Collaborator

@kobergj kobergj left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@saw-jan
Copy link
Member Author

saw-jan commented Jul 28, 2023

LGTM 👍

Thanks 😃
I will push changelog and remove passing test from expected failure list

@saw-jan saw-jan marked this pull request as ready for review July 28, 2023 07:51
@sonarcloud
Copy link

sonarcloud bot commented Jul 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
75.0% 75.0% Duplication

@2403905 2403905 merged commit ec4f56d into master Jul 28, 2023
3 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix/issue-2064-sajan branch July 28, 2023 11:16
ownclouders pushed a commit that referenced this pull request Jul 28, 2023
* fix: instead of whole erro object, only send error detail as message

* remove passing test from expected failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

different error message detail for previews of folder
3 participants