Типа я (zilogic) wrote in changelog,
Типа я
zilogic
changelog

[livejournal] r20339: LJSUP-10155: Properties don't save via X...

Committer: amyshkin
LJSUP-10155: Properties don't save via XML RPC
U   trunk/cgi-bin/LJ/Entry.pm
U   trunk/cgi-bin/ljprotocol.pl
Modified: trunk/cgi-bin/LJ/Entry.pm
===================================================================
--- trunk/cgi-bin/LJ/Entry.pm	2011-10-17 11:14:39 UTC (rev 20338)
+++ trunk/cgi-bin/LJ/Entry.pm	2011-10-17 11:24:21 UTC (rev 20339)
@@ -2259,6 +2259,10 @@
 
         if ( $1 eq 'logprop2' ) {
             next unless ref $v eq "HASH";
+
+            my @vkeys = keys %$v;
+            next if $vkeys[0] =~ /\D/;
+
             delete $needprops{$3};
             $hashref->{$3} = $v;
         }

Modified: trunk/cgi-bin/ljprotocol.pl
===================================================================
--- trunk/cgi-bin/ljprotocol.pl	2011-10-17 11:14:39 UTC (rev 20338)
+++ trunk/cgi-bin/ljprotocol.pl	2011-10-17 11:24:21 UTC (rev 20339)
@@ -2448,6 +2448,7 @@
     # meta-data
     if (%{$req->{'props'}}) {
         my $propset = {};
+
         foreach my $pname (keys %{$req->{'props'}}) {
             next unless $req->{'props'}->{$pname};
             next if $pname eq "revnum" || $pname eq "revtime";
@@ -2456,9 +2457,21 @@
             next unless $req->{'props'}->{$pname};
             $propset->{$pname} = $req->{'props'}->{$pname};
         }
+
         my %logprops;
         LJ::set_logprop($uowner, $jitemid, $propset, \%logprops) if %$propset;
 
+        for my $key ( keys %logprops ) {
+            next if $key =~ /^\d+$/;
+
+            unless ( $LJ::CACHE_PROP{'log'}->{$key}->{'propid'} ) {
+                delete $logprops{$key};
+            }
+            else {
+                $logprops{ $LJ::CACHE_PROP{'log'}->{$key}->{'propid'} } = delete $logprops{$key};
+            }
+        }
+
         # if set_logprop modified props above, we can set the memcache key
         # to be the hashref of modified props, since this is a new post
         LJ::MemCache::set([$uowner->{'userid'}, "logprop2:$uowner->{'userid'}:$jitemid"],
@@ -3001,6 +3014,7 @@
                          "journalid=$ownerid AND jitemid=$itemid");
         return fail($err,501,$dberr) if $dberr;
     }
+
     if ($req->{'props'}->{'opt_backdated'} eq "0" &&
         $oldevent->{'rlogtime'} == $LJ::EndOfTime) {
         my $dberr;

Tags: amyshkin, livejournal, pl, pm, zilogic
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments