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

[stable25] fix(dav): Always respond custom error page on exceptions #48304

Merged
merged 5 commits into from
Oct 1, 2024

Conversation

backportbot[bot]
Copy link

@backportbot backportbot bot commented Sep 23, 2024

Backport of #48297

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot backportbot bot requested a review from artonge September 23, 2024 16:12
@backportbot backportbot bot added the 3. to review Waiting for reviews label Sep 23, 2024
@artonge artonge changed the title [stable25] [stable27] fix(dav): Always respond custom error page on exceptions [stable27] fix(dav): Always respond custom error page on exceptions Sep 24, 2024
@artonge artonge marked this pull request as ready for review September 24, 2024 09:27
apps/dav/lib/Files/ErrorPagePlugin.php Fixed Show fixed Hide fixed
apps/dav/lib/Files/ErrorPagePlugin.php Fixed Show fixed Hide fixed
apps/dav/lib/Files/ErrorPagePlugin.php Fixed Show fixed Hide fixed
apps/dav/lib/Files/ErrorPagePlugin.php Fixed Show fixed Hide fixed
if (BrowserErrorPagePlugin::isBrowserRequest($request)) {
$this->server->addPlugin(new BrowserErrorPagePlugin());
}
$this->server->addPlugin(new ErrorPagePlugin($this->request, \OC::$server->getConfig()));

Check notice

Code scanning / Psalm

DeprecatedMethod Note

The method OC\Server::getConfig has been marked as deprecated
@artonge artonge changed the title [stable27] fix(dav): Always respond custom error page on exceptions [stable25] fix(dav): Always respond custom error page on exceptions Sep 24, 2024
@artonge artonge force-pushed the backport/48297/stable25 branch 2 times, most recently from 20d9af7 to c513c09 Compare September 24, 2024 10:38
public function logException(\Throwable $ex): void {
if ($ex instanceof Exception) {
$httpCode = $ex->getHTTPCode();
$headers = $ex->getHTTPHeaders($this->server);

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 1 of Sabre\DAV\Exception::getHTTPHeaders cannot be null, possibly null value provided
$httpCode = 500;
$headers = [];
}
$this->server->httpResponse->addHeaders($headers);

Check notice

Code scanning / Psalm

PossiblyNullPropertyFetch Note

Cannot get property on possibly null variable $this->server of type Sabre\DAV\Server|null
$httpCode = 500;
$headers = [];
}
$this->server->httpResponse->addHeaders($headers);

Check notice

Code scanning / Psalm

PossiblyNullReference Note

Cannot call method addHeaders on possibly null value
apps/dav/lib/Files/ErrorPagePlugin.php Fixed Show fixed Hide fixed
} else {
$templateName = 'xml_exception';
$renderAs = null;
$this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');

Check notice

Code scanning / Psalm

PossiblyNullPropertyFetch Note

Cannot get property on possibly null variable $this->server of type Sabre\DAV\Server|null
/**
* @codeCoverageIgnore
*/
public function sendResponse() {

Check notice

Code scanning / Psalm

MissingReturnType Note

Method OCA\DAV\Files\ErrorPagePlugin::sendResponse does not have a return type, expecting void
* @codeCoverageIgnore
*/
public function sendResponse() {
$this->server->sapi->sendResponse($this->server->httpResponse);

Check notice

Code scanning / Psalm

PossiblyNullPropertyFetch Note

Cannot get property on possibly null variable $this->server of type Sabre\DAV\Server|null
* @codeCoverageIgnore
*/
public function sendResponse() {
$this->server->sapi->sendResponse($this->server->httpResponse);

Check notice

Code scanning / Psalm

PossiblyNullReference Note

Cannot call method sendResponse on possibly null value
* @codeCoverageIgnore
*/
public function sendResponse() {
$this->server->sapi->sendResponse($this->server->httpResponse);

Check notice

Code scanning / Psalm

PossiblyNullPropertyFetch Note

Cannot get property on possibly null variable $this->server of type Sabre\DAV\Server|null
* @codeCoverageIgnore
*/
public function sendResponse() {
$this->server->sapi->sendResponse($this->server->httpResponse);

Check notice

Code scanning / Psalm

PossiblyNullArgument Note

Argument 1 of Sabre\HTTP\Sapi::sendResponse cannot be null, possibly null value provided
@artonge artonge added bug feature: dav php Pull requests that update Php code labels Sep 26, 2024
@artonge artonge force-pushed the backport/48297/stable25 branch 2 times, most recently from d8e966a to a7d821d Compare September 30, 2024 15:57
artonge and others added 5 commits September 30, 2024 18:30
The `<?xml` tag is interpreted as PHP short tags, so this causes errors.
Instead just print that part of the template.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@artonge artonge force-pushed the backport/48297/stable25 branch 2 times, most recently from 15b695d to fc6ab73 Compare October 1, 2024 08:28
@sorbaugh sorbaugh merged commit 188d747 into stable25 Oct 1, 2024
50 of 57 checks passed
@sorbaugh sorbaugh deleted the backport/48297/stable25 branch October 1, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug feature: dav php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants