1
0
Fork 0

Merge pull request #6005 from nupplaphil/friendica-5996

Fixing absolute/relative path
This commit is contained in:
rabuzarus 2018-10-23 12:26:28 +02:00 committed by GitHub
commit db8968c912
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View file

@ -17,5 +17,5 @@ function toggle_mobile_init(App $a) {
$address = '';
}
$a->internalRedirect($address);
System::externalRedirect($address);
}

View file

@ -2000,7 +2000,7 @@ class App
public function internalRedirect($toUrl = '', $ssl = false)
{
if (filter_var($toUrl, FILTER_VALIDATE_URL)) {
throw new InternalServerErrorException('URL is not a relative path, please use System::externalRedirectTo');
throw new InternalServerErrorException("'$toUrl is not a relative path, please use System::externalRedirectTo");
}
$redirectTo = $this->getBaseURL($ssl) . '/' . ltrim($toUrl, '/');

View file

@ -247,7 +247,7 @@ class System extends BaseObject
public static function externalRedirect($url)
{
if (!filter_var($url, FILTER_VALIDATE_URL)) {
throw new InternalServerErrorException('URL is not a fully qualified URL, please use App->internalRedirect() instead');
throw new InternalServerErrorException("'$url' is not a fully qualified URL, please use App->internalRedirect() instead");
}
header("Location: $url");

View file

@ -34,4 +34,4 @@ class SystemTest extends TestCase
$guid = System::createGUID(23, 'test');
$this->assertGuid($guid, 23, 'test');
}
}
}