File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 88use Psr \Http \Message \ServerRequestInterface ;
99use TYPO3 \CMS \Core \Http \JsonResponse ;
1010use TYPO3 \CMS \Core \Utility \GeneralUtility ;
11+ use TYPO3 \CMS \Core \Utility \StringUtility ;
1112
1213class AjaxController
1314{
@@ -18,15 +19,17 @@ public function checkAction(ServerRequestInterface $request): JsonResponse
1819 $ response = [];
1920 $ parser = GeneralUtility::makeInstance (UrlParser::class);
2021
21- try {
22- $ newValue = $ parser ->parse ($ uri );
23- if ($ newValue !== $ uri ) {
24- $ response ['transformed ' ] = $ newValue ;
25- $ response ['status ' ] = true ;
22+ if (is_string ($ uri ) && !empty ($ uri ) && (StringUtility::beginsWith ($ uri , 'http ' ) || StringUtility::beginsWith ($ uri , '/ ' ))) {
23+ try {
24+ $ newValue = $ parser ->parse ($ uri );
25+ if ($ newValue !== $ uri ) {
26+ $ response ['transformed ' ] = $ newValue ;
27+ $ response ['status ' ] = true ;
28+ }
29+ } catch (\Exception $ exception ) {
30+ $ response ['false ' ] = true ;
31+ $ response ['message ' ] = $ exception ->getMessage ();
2632 }
27- } catch (\Exception $ exception ) {
28- $ response ['false ' ] = true ;
29- $ response ['message ' ] = $ exception ->getMessage ();
3033 }
3134 return new JsonResponse ($ response );
3235 }
You can’t perform that action at this time.
0 commit comments