Added check, if added links end with "/"

Added check if added, or edited links end with "/". Previously if links were saved without this formatting applied an error exception would be thrown.

For this, I used the previously added functions to check if the link ends with the slash.
This commit is contained in:
Julian Prieber 2022-03-31 22:45:51 +02:00
parent 268c6557a1
commit 5e5ce391b9
1 changed files with 12 additions and 4 deletions

View File

@ -99,9 +99,13 @@ class UserController extends Controller
]); ]);
if (stringStartsWith($request->link,'http://') == 'true' or stringStartsWith($request->link,'https://') == 'true' or stringStartsWith($request->link,'mailto:') == 'true') if (stringStartsWith($request->link,'http://') == 'true' or stringStartsWith($request->link,'https://') == 'true' or stringStartsWith($request->link,'mailto:') == 'true')
$link = $request->link; $link1 = $request->link;
else else
$link = 'https://' . $request->link; $link1 = 'https://' . $request->link;
if (stringEndsWith($request->link,'/') == 'true')
$link = rtrim($link1, "/ ");
else
$link = $link1;
if ($request->title == '') if ($request->title == '')
$title = $request->button; $title = $request->button;
else else
@ -206,9 +210,13 @@ class UserController extends Controller
]); ]);
if (stringStartsWith($request->link,'http://') == 'true' or stringStartsWith($request->link,'https://') == 'true' or stringStartsWith($request->link,'mailto:') == 'true') if (stringStartsWith($request->link,'http://') == 'true' or stringStartsWith($request->link,'https://') == 'true' or stringStartsWith($request->link,'mailto:') == 'true')
$link = $request->link; $link1 = $request->link;
else else
$link = 'https://' . $request->link; $link1 = 'https://' . $request->link;
if (stringEndsWith($request->link,'/') == 'true')
$link = rtrim($link1, "/ ");
else
$link = $link1;
$title = $request->title; $title = $request->title;
$order = $request->order; $order = $request->order;
$button = $request->button; $button = $request->button;