Skip to content
Snippets Groups Projects
Commit 6280cb20 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fixed url as route parameter encoding

parent b10dae46
No related branches found
No related tags found
No related merge requests found
......@@ -373,6 +373,10 @@ class ProxyController extends Controller
*/
public function formget(Request $request, $password, $validUntil, $url)
{
// Since url is a route parameter the URL is encoded with bin2hex function
// Reverse the encoding:
$url = pack("H*", $url);
if (empty($password) || empty($validUntil) || empty($url)) {
abort(400, "Invalid Request");
}
......@@ -507,8 +511,11 @@ class ProxyController extends Controller
$validUntil = self::generateValidUntilDate();
$password = self::generatePassword($url, $validUntil);
// url will be a route parameter and might contain unsupported characters
// to make the parameter alphanumeric encoding it with bin2hex should do the trick
// It can later be decoded with pack("H*", $hex_value)
$parameters = [
"url" => $url,
"url" => bin2hex($url),
"validUntil" => $validUntil,
"password" => $password,
];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment