Subject: | Corrupts html values if used to edit/save |
A very solid use case is to use CMS::MediaWiki to open files on your wiki, modify them, and then save them.
However, this usage is broken because CMS::MediaWiki just sends what it recieves (after pulling html encoded text out of a textarea) -- so it produces encoded html, and writes that encoded html back to the wiki (which thus adds a layer of encoding to the produces text. So any html in the source wiki -- any divs, custom html-ish tags, etc adendum -- will be corrupted when it saves back to the wiki.
Solution: use decode_entities from HTML::Entities to decode retrieved text before handing it to clients, thus producing text appropriate to saving without corruption.
Patch:
--- MediaWiki.pm 2014-12-14 19:08:33.121129063 -0800
+++ MediaWiki.pm.orig 2014-12-14 19:05:29.106717520 -0800
@@ -17,7 +17,6 @@
use LWP::UserAgent;
use HTTP::Request::Common;
-use HTML::Entities ();
# GLOBAL VARIABLES
my %Var = ();
@@ -266,9 +265,6 @@
push (@content, $line) if ($saving);
}
- # decode html entities in text, so caller gets clean content.
- @content = map HTML::Entities::decode($_) => @content;
-
# Always return an arrayref for later processing
\@content;
}
Subject: | mediawiki.patch |
--- MediaWiki.pm 2014-12-14 19:08:33.121129063 -0800
+++ MediaWiki.pm.orig 2014-12-14 19:05:29.106717520 -0800
@@ -17,7 +17,6 @@
use LWP::UserAgent;
use HTTP::Request::Common;
-use HTML::Entities ();
# GLOBAL VARIABLES
my %Var = ();
@@ -266,9 +265,6 @@
push (@content, $line) if ($saving);
}
- # decode html entities in text, so caller gets clean content.
- @content = map HTML::Entities::decode($_) => @content;
-
# Always return an arrayref for later processing
\@content;
}