Skip to content

Don't send errors as HTML if request looks like a json request - #15357

Closed
butonic wants to merge 1 commit into
masterfrom
dont_send_errors_as_html_if_request_looks_like_a_json_request_master
Closed

butonic wants to merge 1 commit into
masterfrom
dont_send_errors_as_html_if_request_looks_like_a_json_request_master

Conversation

@butonic

@butonic butonic commented Apr 1, 2015

Copy link
Copy Markdown
Contributor

starting point for #15332 (comment) feel free to hijack.

@butonic

butonic commented Apr 1, 2015

Copy link
Copy Markdown
Contributor Author

cc @nickvergessen @LukasReschke

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should use this->server['HTTP_ACCEPT]

@butonic
butonic force-pushed the dont_send_errors_as_html_if_request_looks_like_a_json_request_master branch from 46a6424 to 15d7825 Compare April 1, 2015 11:46
Comment thread index.php

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what about moving this check inside printExceptionErrorPage() adn even send back the error message as json?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I know this looks ugly. But as a developer you expect printExceptionErrorPage() to output something ... it starts with print.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it starts with print.

in case of json request it will print out json - on cli it will print out plain text - html for all the rest

@scrutinizer-notifier

Copy link
Copy Markdown

The inspection completed: 2 new issues, 1 updated code elements

@PVince81

PVince81 commented Jul 3, 2015

Copy link
Copy Markdown
Contributor

Sometimes I have the feeling that showing an exception page is really a corner case that happens only at setup time or if something is wrong with the setup.
Most of the time non-setup errors happen during ajax operations or webdav.
Maybe we should make JSON and co the default and make a special case for the other one ?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

I'd like to have a solution which somewhat merges with this last-minute-8.1-hack - https://github.com/owncloud/core/blob/master/remote.php#L43

@PVince81

PVince81 commented Sep 1, 2015

Copy link
Copy Markdown
Contributor

Any update for this ?

@MorrisJobke

Copy link
Copy Markdown
Contributor

No activity -> 9.0

@DeepDiver1975
DeepDiver1975 force-pushed the dont_send_errors_as_html_if_request_looks_like_a_json_request_master branch from 15d7825 to 5e24d29 Compare January 13, 2016 12:32
Comment thread index.php

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this should be inverted - right?

If it's NOT a json request the exception page is displayed

@butonic

@MorrisJobke MorrisJobke mentioned this pull request Jan 19, 2016
@MorrisJobke

Copy link
Copy Markdown
Contributor

Fixes #10134

@PVince81 PVince81 modified the milestones: 9.1-next, 9.0-current Feb 11, 2016
@PVince81

Copy link
Copy Markdown
Contributor

We're past feature freeze, changing base.php or base interfaces can be dangerous.

Moving to 9.1

CC @cmonteroluque

@PVince81

Copy link
Copy Markdown
Contributor

Is this critical enough to push this forward ?
If yes, please rebase and review.

Else let's close this and schedule time for a proper discussion about the approach we want here (which we could track in a ticket)
@DeepDiver1975 @butonic

@DeepDiver1975

Copy link
Copy Markdown
Contributor

Else let's close this and schedule time for a proper discussion about the approach we want here (which we could track in a ticket)

@butonic agree to close?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

lets reopen this one day ....

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.

7 participants