fix(files_sharing): show proper share not found error message#46967
Merged
fix(files_sharing): show proper share not found error message#46967
Conversation
szaimen
approved these changes
Aug 2, 2024
Contributor
szaimen
left a comment
There was a problem hiding this comment.
Looks nice from the screenshots :)
1799993 to
a76aa8c
Compare
Contributor
|
We can also consider something like this: diff --git a/core/templates/404.php b/core/templates/404.php
index d2dc10f9aa8..1f58da3ef9d 100644
--- a/core/templates/404.php
+++ b/core/templates/404.php
@@ -21,9 +21,13 @@ if (!isset($_)) {//standalone page is not supported anymore - redirect to /
<?php print_unescaped($_['content']) ?>
<?php else: ?>
<div class="body-login-container update">
- <div class="icon-big icon-search"></div>
- <h2><?php p($l->t('Page not found')); ?></h2>
- <p class="infogroup"><?php p($l->t('The page could not be found on the server or you may not be allowed to view it.')); ?></p>
+ <div class="icon-big <?php p($_['iconClass'] ?? 'icon-search'); ?>"></div>
+ <h2>
+ <?php p($_['heading'] ?? $l->t('Page not found')); ?>
+ </h2>
+ <p class="infogroup">
+ <?php p($_['message'] ?? $l->t('The page could not be found on the server or you may not be allowed to view it.')); ?>
+ </p>
<p><a class="button primary" href="<?php p(\OC::$server->getURLGenerator()->linkTo('', 'index.php')) ?>">
<?php p($l->t('Back to %s', [$theme->getName()])); ?>
</a></p>
diff --git a/lib/public/AppFramework/Http/NotFoundResponse.php b/lib/public/AppFramework/Http/NotFoundResponse.php
index 9ebefe69be1..fa936a82976 100644
--- a/lib/public/AppFramework/Http/NotFoundResponse.php
+++ b/lib/public/AppFramework/Http/NotFoundResponse.php
@@ -12,18 +12,17 @@ use OCP\AppFramework\Http;
/**
* A generic 404 response showing an 404 error page as well to the end-user
* @since 8.1.0
- * @template S of int
* @template H of array<string, mixed>
- * @template-extends TemplateResponse<int, array<string, mixed>>
+ * @template-extends TemplateResponse<Http::STATUS_NOT_FOUND, array<string, mixed>>
*/
class NotFoundResponse extends TemplateResponse {
/**
- * @param S $status
+ * @param array{message?: string, headline?: string, iconClass?: string} $params
* @param H $headers
* @since 8.1.0
*/
- public function __construct(int $status = Http::STATUS_NOT_FOUND, array $headers = []) {
- parent::__construct('core', '404', [], 'guest', $status, $headers);
+ public function __construct(array $params = [], array $headers = []) {
+ parent::__construct('core', '404', $params, 'guest', Http::STATUS_NOT_FOUND, $headers);
$this->setContentSecurityPolicy(new ContentSecurityPolicy());
}Meaning we could make the response customizable (heading, message and icon). |
Member
Author
I also started doing this. But wanted to avoid changing any existing code during freeze 🧊 |
a76aa8c to
f039d1b
Compare
Merged
Member
|
Nice! Indeed this is better :) I would go for this person-cancel symbol instead. Also, the subline is missing a full stop at the end :) |
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
f039d1b to
db28aa8
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When trying to access a share token which doesn't exists or is expired
https://dev.domain.com/s/oiqAxS8tzdPNBzN
Not the best, but a bit cleaner as far as error page goes
@nextcloud/designers