[Pkg-mozext-commits] [adblock-plus] 73/464: Properly encode locale data inserted into install.rdf
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:04 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 43c4c66b05d0ab9fea67b503c1b5fa4e18769032
Author: Wladimir Palant <trev at adblockplus.org>
Date: Fri Mar 26 10:53:42 2010 +0100
Properly encode locale data inserted into install.rdf
---
Packager.pm | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/Packager.pm b/Packager.pm
index ddac1fa..dcb47db 100644
--- a/Packager.pm
+++ b/Packager.pm
@@ -107,12 +107,16 @@ sub readLocaleData
$locale->{name} = $self->{name} unless exists($locale->{name}) && $locale->{name} && $locale->{name} ne $self->{name};
$locale->{description} = $self->{description} unless exists($locale->{description}) && $locale->{description} && $locale->{description} ne $self->{description};
+ my $id = $self->encodeXML($locale->{id});
+ my $name = $self->encodeXML($locale->{name});
+ my $description = $self->encodeXML($locale->{description});
+
$info .= <<EOT;
\t<em:localized>
\t\t<Description>
-\t\t\t<em:locale>$locale->{id}</em:locale>
-\t\t\t<em:name>$locale->{name}</em:name>
-\t\t\t<em:description>$locale->{description}</em:description>
+\t\t\t<em:locale>$id</em:locale>
+\t\t\t<em:name>$name</em:name>
+\t\t\t<em:description>$description</em:description>
\t\t</Description>
\t</em:localized>
EOT
@@ -122,6 +126,7 @@ EOT
foreach my $translator (sort keys %translators)
{
+ $translator = $self->encodeXML($translator);
$info .= <<EOT;
\t<em:translator>$translator</em:translator>
EOT
@@ -271,6 +276,16 @@ sub cp_rec
}
}
+sub encodeXML
+{
+ my ($self, $str) = @_;
+ $str =~ s/&/&/g;
+ $str =~ s/</</g;
+ $str =~ s/>/>/g;
+ $str =~ s/"/"/g; #"
+ return $str;
+}
+
sub createFileDir
{
my ($self, $fileName) = @_;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list