forked from leftypol/leftypol
net.php: remove base64 padding from encoded cursor
This commit is contained in:
parent
e3b89dcc9d
commit
894d5a4b8b
1 changed files with 2 additions and 2 deletions
|
@ -20,14 +20,14 @@ function is_connection_secure(): bool {
|
||||||
* Encodes a string into a base64 variant without characters illegal in urls.
|
* Encodes a string into a base64 variant without characters illegal in urls.
|
||||||
*/
|
*/
|
||||||
function base64_url_encode(string $input): string {
|
function base64_url_encode(string $input): string {
|
||||||
return strtr(base64_encode($input), '+/=', '-_.');
|
return str_replace([ '+', '/', '=' ], [ '-', '_', '' ], base64_encode($input));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes a string from a base64 variant without characters illegal in urls.
|
* Decodes a string from a base64 variant without characters illegal in urls.
|
||||||
*/
|
*/
|
||||||
function base64_url_decode(string $input): string {
|
function base64_url_decode(string $input): string {
|
||||||
return base64_decode(strtr($input, '-_.', '+/='));
|
return base64_decode(strtr($input, '-_', '+/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue