Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added forced reduction to Date object #781

Closed
wants to merge 1 commit into from

2 participants

@Alroniks

Hi.

I use Mac OS and I have some issues.

My meta-data for index.hmtl

---
title: ''
layout: 'default'
dynamic: true
standalone: true
---

When I run docpad server --env ru files with css and javascript not loaded, because I see 500 error.

In console I have this: TypeError: Object 2014-01-25T14:49:35.294Z has no method 'toUTCString'
In Headers on page I saw that Etag have not valid value.

Response Headers

Connection:keep-alive
Content-Length:3858
Content-Type:text/html
Date:Sat, 25 Jan 2014 12:56:27 GMT
ETag:"5226-NaN"
X-Powered-By:Express, DocPad v6.60.3

It fix make Date object from mtime date always.

@balupton
Owner

This is a good interim fix. Ideally we need to find out why they aren't date objects in the first place.

Would you like me to merge this in for the meantime?

@Alroniks

Okey, I will try find place with error deeper. I need some time and I think we can save this PR opened.

@balupton
Owner

Implemented a workaround in v6.60.4.

@balupton balupton closed this
@balupton balupton referenced this pull request from a commit
@balupton balupton v6.60.4. Improvement. Bugfix.
- v6.60.4 January 27, 2014
	- Implemented `304 Not Modified` header
	- Fixed some `date` and `stat` errors (regression since v6.60.0)
		- Thanks to [Anton Wilhelm](https://github.com/timaschew) for [pull
request #787](#787)
		- Thanks to [Ivan Klimchuk](https://github.com/Alroniks) for [pull
request #781](#781)
7e3dfe5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2014
  1. @Alroniks
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/lib/docpad.coffee
View
4 src/lib/docpad.coffee
@@ -4509,8 +4509,8 @@ class DocPad extends EventEmitterGrouped
else
# ETag: `"<size>-<mtime>"`
- ctime = document.get('date') # use the date or mtime, it should always exist
- mtime = document.get('wtime') # use the last generate time, it may not exist though
+ ctime = new Date(document.get('date')) # use the date or mtime, it should always exist
+ mtime = new Date(document.get('wtime')) # use the last generate time, it may not exist though
stat = document.getStat()
res.setHeaderIfMissing('ETag', '"' + stat.size + '-' + Number(mtime) + '"') if mtime
Something went wrong with that request. Please try again.