[mojomojo] Correct URI-unescaping with Encode ≥ 2.53

Petr Pisar ppisar at fedoraproject.org
Tue Apr 29 11:06:05 UTC 2014


commit 069151838a84f609c9657e199d9d535850e8ed72
Author: Petr Písař <ppisar at redhat.com>
Date:   Tue Apr 29 12:57:05 2014 +0200

    Correct URI-unescaping with Encode ≥ 2.53

 ...Mojo-1.10-normalize-name-as-a-byte-string.patch |   38 ++++++++++++++++++++
 mojomojo.spec                                      |    9 ++++-
 2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/MojoMojo-1.10-normalize-name-as-a-byte-string.patch b/MojoMojo-1.10-normalize-name-as-a-byte-string.patch
new file mode 100644
index 0000000..addcf60
--- /dev/null
+++ b/MojoMojo-1.10-normalize-name-as-a-byte-string.patch
@@ -0,0 +1,38 @@
+From f3fb6a261e047ca7068b08c0c292ae22d9007656 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Tue, 29 Apr 2014 12:37:39 +0200
+Subject: [PATCH] normalize name as a byte string
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Since Encode-2.53, Encode::decode_utf8() requires argument to be
+a byte string. Because URI::Escape::uri_unescape() returns unicode
+string on unicode string input, one need to convert it to a byte
+string before.
+
+<https://github.com/mojomojo/mojomojo/issues/121#issuecomment-41651507>
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ lib/MojoMojo/Schema/ResultSet/Page.pm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/MojoMojo/Schema/ResultSet/Page.pm b/lib/MojoMojo/Schema/ResultSet/Page.pm
+index 306aa6a..3f1a7e2 100644
+--- a/lib/MojoMojo/Schema/ResultSet/Page.pm
++++ b/lib/MojoMojo/Schema/ResultSet/Page.pm
+@@ -177,8 +177,8 @@ sub normalize_name {
+     $name =~ s/\s+/_/g;
+     $name = lc($name);
+     return (
+-        Encode::decode_utf8(URI::Escape::uri_unescape($name_orig)),
+-        Encode::decode_utf8(URI::Escape::uri_unescape($name)),
++        Encode::decode_utf8(URI::Escape::uri_unescape(Encode::encode_utf8($name_orig))),
++        Encode::decode_utf8(URI::Escape::uri_unescape(Encode::encode_utf8($name))),
+     );
+ }
+ 
+-- 
+1.9.0
+
diff --git a/mojomojo.spec b/mojomojo.spec
index d7a06d5..1d1a0b0 100644
--- a/mojomojo.spec
+++ b/mojomojo.spec
@@ -1,6 +1,6 @@
 Name:           mojomojo
 Version:        1.10
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        A Wiki with a tree
 License:        GPL+ or Artistic
 Group:          Applications/Internet
@@ -14,6 +14,9 @@ Patch0:         formatter-docbook.patch
 Patch2:         mojomojo-paths.patch
 # remove precompiled swfupload binaries (RHBZ#1000256)
 Patch3:         mojomojo-no-swfupload.patch
+# Correct URI-unescaping with Encode ≥ 2.53, bug #1092015,
+# <https://github.com/mojomojo/mojomojo/issues/121>
+Patch4:         MojoMojo-1.10-normalize-name-as-a-byte-string.patch
 
 BuildArch:      noarch
 
@@ -208,6 +211,7 @@ wiki page.
 %patch0 -p 1
 %patch2 -p 1
 %patch3 -p 1
+%patch4 -p 1
 
 # remove precomplied swfupload
 rm -rf root/static/flash/
@@ -289,6 +293,9 @@ CATALYST_CONFIG=t/var/mojomojo.yml make test
 
 
 %changelog
+* Tue Apr 29 2014 Petr Pisar <ppisar at redhat.com> - 1.10-3
+- Correct URI-unescaping with Encode ≥ 2.53 (bug #1092015)
+
 * Fri Sep 20 2013 Iain Arnell <iarnell at gmail.com> 1.10-2
 - remove bundled swfupload binaries (RHBZ#1000256)
 


More information about the scm-commits mailing list