Skip to content

escapedFragment is falsey if it's an empty string #6

@tvararu

Description

@tvararu

Maybe I'm not reading the spec correctly, but it says that for HTML5 pushstate URLs you get pinged with "?escaped_fragment=". Notice that the get parameter has no value, it's just an empty string.

As such, when I was testing this out on my app, I tried this:

$ curl "http://localhost:3000?_escaped_fragment_="

But this didn't trigger the SEO middleware.

Digging into the source, I found that you do this in lib/mean-seo.js:39:

return function SEO(req, res, next) {
  var escapedFragment = req.query._escaped_fragment_;

  //If the request came from a crawler
  if (escapedFragment) {
    /* do SEO stuff */
  } else {
    next();
  }
}

For my CURL, that comes up as falsey.

Shouldn't the if conditional rather test for escapedFragment !== undefined?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions