[Bps-public-commit] r15201 - in Data-ICal: . lib/Data/ICal t

alexmv at bestpractical.com alexmv at bestpractical.com
Sun Aug 17 15:10:33 EDT 2008


Author: alexmv
Date: Sun Aug 17 15:10:32 2008
New Revision: 15201

Modified:
   Data-ICal/   (props changed)
   Data-ICal/lib/Data/ICal/Entry.pm
   Data-ICal/lib/Data/ICal/Property.pm
   Data-ICal/t/08.parse.t
   Data-ICal/t/ics/test.ics

Log:
 r36070 at kohr-ah:  chmrr | 2008-08-17 15:10:28 -0400
  * Escaping fixes


Modified: Data-ICal/lib/Data/ICal/Entry.pm
==============================================================================
--- Data-ICal/lib/Data/ICal/Entry.pm	(original)
+++ Data-ICal/lib/Data/ICal/Entry.pm	Sun Aug 17 15:10:32 2008
@@ -487,6 +487,17 @@
         foreach my $occurence (@$val) {
             my $prop;
 
+            # Unescapes, but only in v2, and not if it's explicitly not TEXT
+            if (not $parent->vcal10
+                and (  not $occurence->{param}
+                    or not defined $occurence->{param}{VALUE}
+                    or $occurence->{param}{VALUE} eq "TEXT" )
+                )
+            {
+                $occurence->{value} =~ s/\\([;,\\])/$1/g;
+                $occurence->{value} =~ s/\\n/\n/ig;
+            }
+            
             # handle optional params and 'normal' key/value pairs
             # TODO: line wrapping?
             if ( $occurence->{param} ) {

Modified: Data-ICal/lib/Data/ICal/Property.pm
==============================================================================
--- Data-ICal/lib/Data/ICal/Property.pm	(original)
+++ Data-ICal/lib/Data/ICal/Property.pm	Sun Aug 17 15:10:32 2008
@@ -215,7 +215,7 @@
     
     unless ($self->vcal10) {
         $value =~ s/\\/\\/gs;
-        $value =~ s/\Q;/\\;/gs unless lc($key) eq 'rrule';
+        $value =~ s/;/\\;/gs unless lc($key) eq 'rrule';
         $value =~ s/,/\\,/gs unless lc($key) eq 'rrule';
         $value =~ s/\n/\\n/gs;
         $value =~ s/\\N/\\N/gs;

Modified: Data-ICal/t/08.parse.t
==============================================================================
--- Data-ICal/t/08.parse.t	(original)
+++ Data-ICal/t/08.parse.t	Sun Aug 17 15:10:32 2008
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-use constant TESTS_IN_TEST_CALENDAR => 15;
+use constant TESTS_IN_TEST_CALENDAR => 16;
 use Test::More tests => 9 + 3 * TESTS_IN_TEST_CALENDAR;
 use Test::LongString;
 use Test::NoWarnings; # this catches our warnings like setting unknown properties
@@ -75,6 +75,7 @@
 
     # Event 
     isa_ok($event, 'Data::ICal::Entry::Event');
+    is($event->property('summary')->[0]->value, 'Data::ICal release party,other things with slash\es');
     is($event->property('location')->[0]->value, 'The Restaurant at the End of the Universe', 'Correct location');
     is($event->property('url')->[0]->value, 'http://www.bestpractical.com', 'Correct URL');
     is($event->property('url')->[0]->parameters->{VALUE}, 'URI', 'Got parameter');

Modified: Data-ICal/t/ics/test.ics
==============================================================================
--- Data-ICal/t/ics/test.ics	(original)
+++ Data-ICal/t/ics/test.ics	Sun Aug 17 15:10:32 2008
@@ -47,7 +47,7 @@
 DURATION:PT6H
 LOCATION:The Restaurant at the End of the Universe
 SEQUENCE:42
-SUMMARY:Data::ICal release party
+SUMMARY:Data::ICal release party\,other things with slash\\es
 URL;VALUE=URI:http://www.bestpractical.com
 BEGIN:VALARM
 TRIGGER;VALUE=DATE-TIME:19970317T133000Z



More information about the Bps-public-commit mailing list