Merge pull request #4753 from nextcloud/fix-links-on-error-page

Fix escaped HTML on error pages
This commit is contained in:
Roeland Jago Douma 2017-05-09 08:45:11 +02:00 committed by GitHub
commit dfa3aaa0c6
3 changed files with 11 additions and 17 deletions

View File

@ -246,9 +246,8 @@ class OC {
} else { } else {
OC_Template::printErrorPage( OC_Template::printErrorPage(
$l->t('Cannot write into "config" directory!'), $l->t('Cannot write into "config" directory!'),
$l->t('This can usually be fixed by ' $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s',
. '%sgiving the webserver write access to the config directory%s.', [ $urlGenerator->linkToDocs('admin-dir_permissions') ])
array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>'))
); );
} }
} }

View File

@ -249,8 +249,7 @@ class Config {
$url = \OC::$server->getURLGenerator()->linkToDocs('admin-dir_permissions'); $url = \OC::$server->getURLGenerator()->linkToDocs('admin-dir_permissions');
throw new HintException( throw new HintException(
"Can't write into config directory!", "Can't write into config directory!",
'This can usually be fixed by ' 'This can usually be fixed by giving the webserver write access to the config directory. See ' . $url);
.'<a href="' . $url . '" target="_blank" rel="noreferrer">giving the webserver write access to the config directory</a>.');
} }
// Try to acquire a file lock // Try to acquire a file lock

View File

@ -669,9 +669,8 @@ class OC_Util {
if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
$errors[] = array( $errors[] = array(
'error' => $l->t('Cannot write into "config" directory'), 'error' => $l->t('Cannot write into "config" directory'),
'hint' => $l->t('This can usually be fixed by ' 'hint' => $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s',
. '%sgiving the webserver write access to the config directory%s.', [$urlGenerator->linkToDocs('admin-dir_permissions')])
array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>'))
); );
} }
} }
@ -684,10 +683,9 @@ class OC_Util {
) { ) {
$errors[] = array( $errors[] = array(
'error' => $l->t('Cannot write into "apps" directory'), 'error' => $l->t('Cannot write into "apps" directory'),
'hint' => $l->t('This can usually be fixed by ' 'hint' => $l->t('This can usually be fixed by giving the webserver write access to the apps directory'
. '%sgiving the webserver write access to the apps directory%s' . ' or disabling the appstore in the config file. See %s',
. ' or disabling the appstore in the config file.', [$urlGenerator->linkToDocs('admin-dir_permissions')])
array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>'))
); );
} }
} }
@ -700,16 +698,14 @@ class OC_Util {
} else { } else {
$errors[] = [ $errors[] = [
'error' => $l->t('Cannot create "data" directory'), 'error' => $l->t('Cannot create "data" directory'),
'hint' => $l->t('This can usually be fixed by ' 'hint' => $l->t('This can usually be fixed by giving the webserver write access to the root directory. See %s',
. '<a href="%s" target="_blank" rel="noreferrer">giving the webserver write access to the root directory</a>.',
[$urlGenerator->linkToDocs('admin-dir_permissions')]) [$urlGenerator->linkToDocs('admin-dir_permissions')])
]; ];
} }
} else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { } else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
//common hint for all file permissions error messages //common hint for all file permissions error messages
$permissionsHint = $l->t('Permissions can usually be fixed by ' $permissionsHint = $l->t('Permissions can usually be fixed by giving the webserver write access to the root directory. See %.',
. '%sgiving the webserver write access to the root directory%s.', [$urlGenerator->linkToDocs('admin-dir_permissions')]);
['<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank" rel="noreferrer">', '</a>']);
$errors[] = [ $errors[] = [
'error' => 'Your data directory is not writable', 'error' => 'Your data directory is not writable',
'hint' => $permissionsHint 'hint' => $permissionsHint