node-ecstatic icon indicating copy to clipboard operation
node-ecstatic copied to clipboard

Windows Infinite 302 Redirection

Open nashaofu opened this issue 5 years ago • 1 comments

https://github.com/jfhbrook/node-ecstatic/blob/ae7a39b1ecdbe3aa8c0162ab2c3f7365bf9a6d75/lib/ecstatic.js#L23-L31

Windows pathname parsing is incorrect

https://github.com/jfhbrook/node-ecstatic/blob/ae7a39b1ecdbe3aa8c0162ab2c3f7365bf9a6d75/lib/ecstatic.js#L393-L399 Or modify here to

if (!parsed.pathname.match(/\/$/)) {
  res.statusCode = 302;
  const q = parsed.query ? `?${parsed.query}` : '';
  res.setHeader('location', `${parsed.pathname}/${q}`);
  res.end();
  return;
}

nashaofu avatar May 09 '19 07:05 nashaofu

Regressed in commit https://github.com/jfhbrook/node-ecstatic/commit/be6fc25a826f190b67f4d16158f9d67899e38ee4 which was also backported to 3.x series with https://github.com/jfhbrook/node-ecstatic/commit/d0e2bcf40e31d361f6cc419b4b5c2c7846e0dad6.

bjornharrtell avatar Aug 07 '19 12:08 bjornharrtell