You are here: Foswiki>Tasks Web>Item15076 (06 Aug 2023, MichaelDaum)Edit Attach

Item15076: RCS store does not properly encode topic information

pencil
Priority: Urgent
Current State: Closed
Released In: 2.1.8
Target Release: patch
Applies To: Extension
Component: RCSStoreContrib
Branches: Release02x01 master
Reported By: MichaelDaum
Waiting For:
Last Change By: MichaelDaum
There are two ways history is written into the store: saveTopic() and repRev(). While both encoded the topic text and the comment during save, repRev() does not encode the cUID value properly. It does so during saveTopic not so during repRev(). This leads to the topic being downgraded from utf8 to latin1 during save as perl's attempt to resolve the broken mixed encoding on its way to the disk.

Hotfix:

diff --git a/RCSStoreContrib/lib/Foswiki/Store/Rcs/Store.pm b/RCSStoreContrib/lib/Foswiki/Store/Rcs/Store.pm
index 153e2859f..f5e061535 100644
--- a/RCSStoreContrib/lib/Foswiki/Store/Rcs/Store.pm
+++ b/RCSStoreContrib/lib/Foswiki/Store/Rcs/Store.pm
@@ -458,6 +458,7 @@ sub repRev {
     my $handler = $this->getHandler( $topicObject->web, $topicObject->topic );
     my $text    = Foswiki::Serialise::serialise( $topicObject, 'Embedded' );
     $text = _encode($text);
+    $cUID = _encode($cUID);
 
     $handler->replaceRevision( $text, 'reprev', $cUID,
         defined $options{forcedate} ? $options{forcedate} : $info->{date} );

-- MichaelDaum - 31 Mar 2022

 
Topic revision: r2 - 06 Aug 2023, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy