diff options
author | Stephan Orbaugh <62374139+sorbaugh@users.noreply.github.com> | 2024-09-10 10:56:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 10:56:48 +0200 |
commit | 3c2ead71330b2510b2266c9883d1d0b157424425 (patch) | |
tree | 590e93f3d47ece773f4b008af2ce0f55bfd4a76d /core | |
parent | bfb9c9b55c7716c4527721e479a7cdeb6342c6bc (diff) | |
parent | 414a66e02383de0b805a17361966cc269a90416c (diff) | |
download | nextcloud-server-3c2ead71330b2510b2266c9883d1d0b157424425.tar.gz nextcloud-server-3c2ead71330b2510b2266c9883d1d0b157424425.zip |
Merge pull request #47785 from nextcloud/backport/47770/stable28
[stable28] fix(dav): Always respond custom error page on exceptions
Diffstat (limited to 'core')
-rw-r--r-- | core/templates/xml_exception.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/core/templates/xml_exception.php b/core/templates/xml_exception.php new file mode 100644 index 00000000000..342238d824b --- /dev/null +++ b/core/templates/xml_exception.php @@ -0,0 +1,47 @@ +<?php +/** + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2012-2015 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only + */ + +function print_exception(Throwable $e, \OCP\IL10N $l): void { + p($e->getTraceAsString()); + + if ($e->getPrevious() !== null) { + print_unescaped('<s:previous-exception>'); + print_exception($e->getPrevious(), $l); + print_unescaped('</s:previous-exception>'); + } +} + +print_unescaped('<?xml version="1.0" encoding="utf-8"?>' . "\n"); +?> +<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> + <s:exception><?php p($l->t('Internal Server Error')) ?></s:exception> + <s:message> + <?php p($l->t('The server was unable to complete your request.')) ?> + <?php p($l->t('If this happens again, please send the technical details below to the server administrator.')) ?> + <?php p($l->t('More details can be found in the server log.')) ?> + <?php if (isset($_['serverLogsDocumentation']) && $_['serverLogsDocumentation'] !== ''): ?> + <?php p($l->t('For more details see the documentation ↗.'))?>: <?php print_unescaped($_['serverLogsDocumentation']) ?> + <?php endif; ?> + </s:message> + + <s:technical-details> + <s:remote-address><?php p($_['remoteAddr']) ?></s:remote-address> + <s:request-id><?php p($_['requestID']) ?></s:request-id> + + <?php if (isset($_['debugMode']) && $_['debugMode'] === true): ?> + <s:type><?php p($_['errorClass']) ?></s:type> + <s:code><?php p($_['errorCode']) ?></s:code> + <s:message><?php p($_['errorMsg']) ?></s:message> + <s:file><?php p($_['file']) ?></s:file> + <s:line><?php p($_['line']) ?></s:line> + + <s:stacktrace> + <?php print_exception($_['exception'], $l); ?> + </s:stacktrace> + <?php endif; ?> + </s:technical-details> +</d:error> |