Forward porting fixes for iCal escaping and unescaping, and line wrapping.
This commit is contained in:
parent
109178ac6a
commit
c30614bdf6
5 changed files with 89 additions and 9 deletions
|
|
@ -25,6 +25,7 @@ use base 'WebGUI::Asset::Wobject';
|
|||
|
||||
use DateTime;
|
||||
use JSON;
|
||||
use Text::Wrap;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -1741,14 +1742,16 @@ that ; , \ and newlines should be escaped by prepending them with a \.
|
|||
sub wrapIcal {
|
||||
my $self = shift;
|
||||
my $text = shift;
|
||||
|
||||
return $text unless length $text >= 75;
|
||||
|
||||
|
||||
$text =~ s/([,;\\])/\\$1/g;
|
||||
$text =~ s/\n/\\n/g;
|
||||
|
||||
my @text = ($text =~ m/.{1,75}/g);
|
||||
return join "\r\n ",@text;
|
||||
|
||||
{
|
||||
local $Text::Wrap::separator = "\r\n";
|
||||
local $Text::Wrap::columns = 74;
|
||||
$text = Text::Wrap::wrap('', ' ', $text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -528,9 +528,17 @@ sub _icalToMySQL {
|
|||
)->toMysql;
|
||||
}
|
||||
|
||||
=head2 _unwrapIcalText
|
||||
|
||||
This really just unescapes iCal text, handling commas, semi-colons, backslashes
|
||||
and newlines
|
||||
|
||||
=cut
|
||||
|
||||
sub _unwrapIcalText {
|
||||
my $text = shift;
|
||||
$text =~ s/\\([,;\\])/$1/g;
|
||||
$text =~ s/\\n/\n/g;
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue