craftcms / gatsby-helper

Craft CMS helper plugin for Gatsby.
https://plugins.craftcms.com/gatsby-helper
MIT License
15 stars 6 forks source link

Preview URLs without a port defined will fail #4

Closed monachilada closed 3 years ago

monachilada commented 3 years ago

Referencing this line: https://github.com/craftcms/gatsby-helper/blob/a7febe59a99ef0e13f5bc2c1a9a69f641cf3ff53/src/Plugin.php#L162

If I supply a preview URL that doesn't have a port number — meaning I'm assuming port 80 as the default — then this check will fail.

alexhillel commented 3 years ago

I think there is also a mis-match in logic here with the code in line 176:

if ((doPreview || currentlyPreviewing) && (!doPreview || ("$compare" == compareUrl.protocol + '//' + compareUrl.host))) {

I think that there is no way for this to match if the port is included in the $compare string in line 162.

brandonkelly commented 3 years ago

Gatsby Helper 1.0.0-beta.2 is out now with a fix for this.