user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH] wwwatomstream: call gmtime with scalar
  2021-10-22  4:49  6% [PATCH] wwwatomstream: call gmtime with scalar Kyle Meyer
@ 2021-10-22  5:31  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-10-22  5:31 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: meta

Thanks, pushed as 45f87867107724371d80a563099ab93eda1d919b

^ permalink raw reply	[relevance 7%]

* [PATCH] wwwatomstream: call gmtime with scalar
@ 2021-10-22  4:49  6% Kyle Meyer
  2021-10-22  5:31  7% ` Eric Wong
  0 siblings, 1 reply; 2+ results
From: Kyle Meyer @ 2021-10-22  4:49 UTC (permalink / raw)
  To: meta

When the gmtime() calls were moved from feed_entry() and atom_header()
into feed_updated() in c447bbbd, @_ rather than a scalar was passed to
gmtime().  As a result, feed <updated> values end up as
"1970-01-01T00:00:00Z".

Switch back to using a scalar argument to restore the correct
timestamps.

Fixes: c447bbbddb4ac8e1 ("wwwatomstream: simplify feed_update callers")
---
 lib/PublicInbox/WwwAtomStream.pm | 3 ++-
 t/psgi_v2.t                      | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/WwwAtomStream.pm b/lib/PublicInbox/WwwAtomStream.pm
index f60251b7..5d32294e 100644
--- a/lib/PublicInbox/WwwAtomStream.pm
+++ b/lib/PublicInbox/WwwAtomStream.pm
@@ -161,7 +161,8 @@ sub feed_entry {
 }
 
 sub feed_updated {
-	'<updated>' . strftime('%Y-%m-%dT%H:%M:%SZ', gmtime(@_)) . '</updated>';
+	my ($t) = @_;
+	'<updated>' . strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($t)) . '</updated>';
 }
 
 1;
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index e0570682..64c1a8d3 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -92,6 +92,11 @@ my $client0 = sub {
 	@bodies = ($res->content =~ /^(hello [^<]+)$/mg);
 	is_deeply(\@bodies, [ "hello world!\n", "hello world\n" ],
 		'new.html ordering is chronological');
+
+	$res = $cb->(GET('/v2test/new.atom'));
+	my @dates = ($res->content =~ m!title><updated>([^<]+)</updated>!g);
+	is_deeply(\@dates, [ "1993-10-02T00:01:00Z", "1993-10-02T00:00:00Z" ],
+		'Date headers made it through');
 };
 test_psgi(sub { $www->call(@_) }, $client0);
 my $env = { TMPDIR => $tmpdir, PI_CONFIG => $cfgpath };

base-commit: 4cd7a78f3b8c03670e2d77675229472506eee1eb
-- 
2.33.1


^ permalink raw reply related	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-10-22  4:49  6% [PATCH] wwwatomstream: call gmtime with scalar Kyle Meyer
2021-10-22  5:31  7% ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).