passionweb-manuel-schnabel / ai-seo-helper

Generates SEO metadata based on content using AI. Currently several metadata for pages and articles of EXT:news can be generated using an additional button next to the corresponding input fields.
9 stars 5 forks source link

Error if base: / #15

Open lsascha opened 3 weeks ago

lsascha commented 3 weeks ago

If base is set to / and not to a FQDN including scheme, You receive following error:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: Unable to parse URI: : | GuzzleHttp\Psr7\Exception\MalformedUriException thrown in file /usr/www/users/someuser/somedomain.de/releases/111/vendor/guzzlehttp/psr7/src/Uri.php in line 85. Requested URL: https://somedomain.de/typo3/ajax/generate/meta-description?token=--AnonymizedToken--

that happens because https://github.com/passionweb-manuel-schnabel/ai-seo-helper/blob/master/Classes/Service/ContentService.php#L213

->getScheme() and ->getHost() are empty. So cURL receives URLs like :// or :///subpage

Not sure if it should be considered a core bug.

Possible fixes:

passionweb-manuel-schnabel commented 3 weeks ago

Hey @lsascha ,

thanks for reporting the issue and for the several suggestions how to possibly solve this problem.

I will try to fix this as soon as possible and check for possible side effects.

Greetings Manu

passionweb-manuel-schnabel commented 2 weeks ago

Hey @lsascha ,

I have added a fallback solution which fetches the host and the scheme from the current request.

However, if you have multiple site configs with relative paths and no FQDN this can lead to a wrong preview url detection. But I think that such site config scenarios a really really rare.

Could you check if this fallback solves your problem with the "/" as base url?

Greetings Manu