Server error/hint pages with a 500 error code to avoid it being seen …#9995
Server error/hint pages with a 500 error code to avoid it being seen …#9995MorrisJobke merged 2 commits intomasterfrom
Conversation
lib/private/legacy/template.php
Outdated
| $hint = ''; | ||
| } | ||
|
|
||
| header(self::getHttpProtocol() . ' 500 Internal Server Error'); |
There was a problem hiding this comment.
I just used the way it was before. We can of course also move to this. What is the advantage? No need to juggle again with the protocol and terms behind the code?
There was a problem hiding this comment.
I would for now vote for this approach to have a minimal backportable solution and then fix the http_response_code in a separated PR.
There was a problem hiding this comment.
Just noticed that it is not that easy and I will change it already to make the code more clear.
6186e83 to
574aa04
Compare
574aa04 to
6fb0ae2
Compare
Codecov Report
@@ Coverage Diff @@
## master #9995 +/- ##
=========================================
Coverage ? 51.98%
Complexity ? 26014
=========================================
Files ? 1660
Lines ? 96145
Branches ? 1290
=========================================
Hits ? 49983
Misses ? 46162
Partials ? 0
|
6fb0ae2 to
77826b3
Compare
|
Okay - I fixed a bit more, but now error and exception pages are properly covered. I would not backport it anymore, but this should be fine for now. Ready for review 🚢 |
lib/private/legacy/template.php
Outdated
| * @suppress PhanAccessMethodInternal | ||
| */ | ||
| public static function printErrorPage( $error_msg, $hint = '' ) { | ||
| public static function printErrorPage( $error_msg, $hint = '', $statusCode = \OC_Response::STATUS_INTERNAL_SERVER_ERROR ) { |
There was a problem hiding this comment.
This might be very specific and unexpected, but what if the OC_Response class has not been loaded at this point and autoloading causes another error/exception? Should we use 500 instead, just to be on the safe side?
There was a problem hiding this comment.
Sure - let me update it.
a2efd12 to
18e8c5c
Compare
…instead of the actual resource * found while reviewing #7205 * allow to specify a special status code Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
18e8c5c to
1399f6b
Compare
…instead of the actual resource
Could this solve most of the issues we had in the past with files being overwritten? Because error pages were served with HTTP code 200 :/
This should at least avoid problems with clients and the web UI.
Usages: