Modify the atom ids to use a valid URN, using tag URIs as described in
RFC 4151.
Patch by kaisa.
diffs (78 lines):
diff -r 4c40adbf5220 -r ad0e788374b0
cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm
--- a/cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm Wed Jun 23 18:45:52
2010 +0800
+++ b/cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm Thu Jun 24 15:49:10
2010 +0800
@@ -366,7 +366,7 @@ sub handle_edit {
# the AtomEntry must include <id> which must match the one we sent
# on GET
- unless ($entry->id() =~ m#atom1:$u->{'user'}:(\d+)$# &&
+ unless ($entry->id =~ m#,\d{4}-\d{2}-\d{2}:$u->{userid}:(\d+)$# &&
$1 == $olditem->{'itemid'}*256 + $olditem->{'anum'}) {
return respond($r, 400, "Incorrect <b><id></b> field in this
request.");
}
diff -r 4c40adbf5220 -r ad0e788374b0 cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm Wed Jun 23 18:45:52 2010 +0800
+++ b/cgi-bin/LJ/Entry.pm Thu Jun 24 15:49:10 2010 +0800
@@ -560,8 +560,10 @@ sub atom_id {
my $u = $self->{u};
my $ditemid = $self->ditemid;
+ my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
gmtime( $u->timecreate );
+ my $journalcreated = sprintf( "%04d-%02d-%02d", $year+1900, $mon+1, $mday
);
- return "urn:lj:$LJ::DOMAIN:atom1:$u->{user}:$ditemid";
+ return "tag:$LJ::DOMAIN,$journalcreated:$u->{userid}:$ditemid";
}
# returns an XML::Atom::Entry object for a feed
diff -r 4c40adbf5220 -r ad0e788374b0 cgi-bin/ljfeed.pl
--- a/cgi-bin/ljfeed.pl Wed Jun 23 18:45:52 2010 +0800
+++ b/cgi-bin/ljfeed.pl Thu Jun 24 15:49:10 2010 +0800
@@ -440,6 +440,9 @@ sub create_view_atom
$author->email( $journalu->email_for_feeds ) if $journalu &&
$journalu->email_for_feeds;
$author->name( $u->{'name'} );
+ my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
gmtime( $u->timecreate );
+ my $journalcreated = sprintf( "%04d-%02d-%02d", $year+1900, $mon+1, $mday
);
+
# feed information
unless ($opts->{'single_entry'}) {
$feed = XML::Atom::Feed->new( Version => 1 );
@@ -453,7 +456,7 @@ sub create_view_atom
$xml->insertBefore( $xml->createComment(
LJ::Hooks::run_hook("bot_director") ), $xml->documentElement());
# attributes
- $feed->id( "urn:lj:$LJ::DOMAIN:atom1:$u->{user}" );
+ $feed->id( "tag:$LJ::DOMAIN,$journalcreated:$u->{userid}" );
$feed->title( $j->{'title'} || $u->{user} );
if ( $j->{'subtitle'} ) {
$feed->subtitle( $j->{'subtitle'} );
@@ -513,7 +516,7 @@ sub create_view_atom
my $entry = XML::Atom::Entry->new( Version => 1 );
my $entry_xml = $entry->{doc};
- $entry->id("urn:lj:$LJ::DOMAIN:atom1:$u->{user}:$ditemid");
+ $entry->id( "tag:$LJ::DOMAIN,$journalcreated:$u->{userid}:$ditemid" );
# author isn't required if it is in the main <feed>
# only add author if we are in a single entry view, or
@@ -892,7 +895,9 @@ sub create_view_userpics {
$xml->insertBefore( $xml->createComment( $bot ), $xml->documentElement())
if $bot;
- $feed->id( "urn:lj:$LJ::DOMAIN:atom1:$u->{user}:userpics" );
+ my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) =
gmtime( $u->timecreate );
+ my $journalcreated = sprintf( "%04d-%02d-%02d", $year+1900, $mon+1, $mday
);
+ $feed->id( "tag:$LJ::DOMAIN,$journalcreated:$u->{userid}:userpics" );
$feed->title( "$u->{user}'s userpics" );
$feed->author( $author );
@@ -944,7 +949,7 @@ sub create_view_userpics {
my $entry = XML::Atom::Entry->new( Version => 1 );
my $entry_xml = $entry->{doc};
-
$entry->id("urn:lj:$LJ::DOMAIN:atom1:$u->{user}:userpics:$pic->{picid}");
+ $entry->id(
"tag:$LJ::DOMAIN,$journalcreated:$u->{userid}:userpics:$pic->{picid}" );
my $title = ($pic->{picid} == $u->{defaultpicid}) ? "default userpic"
: "userpic";
$entry->title( $title );
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog