Page MenuHomePhabricator

Special:Import now eating all ampersands
Closed, ResolvedPublic

Description

Special:Import will eat all ampersands!
Do not use Special:Import unless you want your imports damaged.
Same problem for importDump.php.
Your file will not make the round trip Special:Export ->
Special:Import unscathed! importTextFile.php is safe though.

Proof:
Make a page called [[Test]] whose wikitext is:
1&2&[http://x.y/bla?o&p=q&r=s&v=t ooo]
Then run this shell script:
site=http://my.example.com
POST "$site/index.php?title=Special:Export&action=submit" <<EOF|tee 1.xml|sed s/Test/Test2/ > 2.xml
catname=&nsindex=0&pages=Test&curonly=1&wpDownload=1
EOF
diff -U0 [12].xml
#Then import 2.xml via Special:Import or importDump.php. Then
for i in '' 2
do GET "$site/index.php?title=Test$i&action=raw"; echo
done

You will see:

  • <title>Test</title>

+ <title>Test2</title>
1&2&amp;[http://x.y/bla?o&p=q&r=s&amp;v=t ooo]
12amp;[http://x.y/bla?op=qr=samp;v=t ooo]

The last line is the mangled result.
Tested on a wiki with $wgLanguageCode='zh-tw'. Probably affects en too.


Version: 1.15.x
Severity: normal

Details

Reference
bz18022

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:35 PM
bzimport set Reference to bz18022.
bzimport added a subscriber: Unknown Object (MLST).

mike.lifeguard+bugs wrote:

(In reply to comment #0)

Special:Import will eat all ampersands!

Please try not to be hyperbolic.

  • This bug has been marked as a duplicate of bug 16554 ***