Fix atom, ical and json exports

This commit is contained in:
Igor Scheller 2022-12-21 11:42:55 +01:00
parent f835a7538c
commit 700d841a87
3 changed files with 4 additions and 4 deletions

View File

@ -386,7 +386,7 @@ function shifts_json_export_controller()
if ( if (
!$request->has('key') !$request->has('key')
|| !preg_match('/^[\da-f]{32}$/', $request->input('key')) || !$request->input('key')
|| !$user || !$user
) { ) {
throw new HttpForbidden('{"error":"Missing or invalid key"}', ['content-type' => 'application/json']); throw new HttpForbidden('{"error":"Missing or invalid key"}', ['content-type' => 'application/json']);

View File

@ -15,7 +15,7 @@ function user_atom()
if ( if (
!$request->has('key') !$request->has('key')
|| !preg_match('/^[\da-f]{32}$/', $request->input('key')) || !$request->input('key')
|| empty($user) || empty($user)
) { ) {
throw new HttpForbidden('Missing or invalid key', ['content-type' => 'text/text']); throw new HttpForbidden('Missing or invalid key', ['content-type' => 'text/text']);
@ -50,7 +50,7 @@ function make_atom_entries_from_news($news_entries)
<title>' . config('app_name') . '</title> <title>' . config('app_name') . '</title>
<id>' . $request->getHttpHost() <id>' . $request->getHttpHost()
. htmlspecialchars(preg_replace( . htmlspecialchars(preg_replace(
'#[&?]key=[a-f\d]{32}#', '#[&?]key=[a-f\d]+#',
'', '',
$request->getRequestUri() $request->getRequestUri()
)) ))

View File

@ -13,7 +13,7 @@ function user_ical()
if ( if (
!$request->has('key') !$request->has('key')
|| !preg_match('/^[\da-f]{32}$/', $request->input('key')) || !$request->input('key')
|| !$user || !$user
) { ) {
throw new HttpForbidden('Missing or invalid key', ['content-type' => 'text/text']); throw new HttpForbidden('Missing or invalid key', ['content-type' => 'text/text']);