oembed icon indicating copy to clipboard operation
oembed copied to clipboard

GrapQL - Error when querying an entry with a empty oEmbed URL

Open jaapfaes opened this issue 1 year ago • 0 comments

Issue: When running a GraphQL query to fetch an entry that includes an oEmbed field, an error occurs if the oEmbed field does not have a URL specified.

Error Message: Embed\Embed::get(): Argument #1 ($url) must be of type string, null given, called in /var/www/vhosts/aswakeukens.nl/subdomains/cms/vendor/wrav/oembed/src/services/OembedService.php on line 89

Proposed Solution: I believe this issue can be easily resolved by passing an empty string when the $url value is null. This prevents the error and allows the query to return a valid response.

Pull Request: I've created a small PR that addresses this issue. You can review it here: #157.

Thank you for looking into this!

jaapfaes avatar Jul 25 '24 14:07 jaapfaes