File tree Expand file tree Collapse file tree 4 files changed +36
-2
lines changed
Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -461,7 +461,12 @@ sub download_mw_mediafile {
461461
462462 my $response = $mediawiki -> {ua }-> get($download_url );
463463 if ($response -> code == HTTP_CODE_OK) {
464- return $response -> decoded_content;
464+ # It is tempting to return
465+ # $response->decoded_content({charset => "none"}), but
466+ # when doing so, utf8::downgrade($content) fails with
467+ # "Wide character in subroutine entry".
468+ $response -> decode();
469+ return $response -> content();
465470 } else {
466471 print {*STDERR } " Error downloading mediafile from :\n " ;
467472 print {*STDERR } " URL: ${download_url} \n " ;
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ usage () {
2020 echo " install | -i : Install a wiki on your computer."
2121 echo " delete | -d : Delete the wiki and all its pages and "
2222 echo " content."
23+ echo " start | -s : Start the previously configured lighttpd daemon"
24+ echo " stop : Stop lighttpd daemon."
2325}
2426
2527
@@ -33,6 +35,14 @@ case "$1" in
3335 wiki_delete
3436 exit 0
3537 ;;
38+ " start" | " -s" )
39+ start_lighttpd
40+ exit
41+ ;;
42+ " stop" )
43+ stop_lighttpd
44+ exit
45+ ;;
3646 " --help" | " -h" )
3747 usage
3848 exit 0
Original file line number Diff line number Diff line change @@ -58,6 +58,25 @@ test_expect_success 'git clone works on previously created wiki with media files
5858 test_cmp mw_dir_clone/Foo.txt mw_dir/Foo.txt
5959'
6060
61+ test_expect_success ' git push can upload media (File:) files containing valid UTF-8' '
62+ wiki_reset &&
63+ git clone mediawiki::' " $WIKI_URL " ' mw_dir &&
64+ (
65+ cd mw_dir &&
66+ "$PERL_PATH" -e "print STDOUT \"UTF-8 content: éèàéê€.\";" >Bar.txt &&
67+ git add Bar.txt &&
68+ git commit -m "add a text file with UTF-8 content" &&
69+ git push
70+ )
71+ '
72+
73+ test_expect_success ' git clone works on previously created wiki with media files containing valid UTF-8' '
74+ test_when_finished "rm -rf mw_dir mw_dir_clone" &&
75+ git clone -c remote.origin.mediaimport=true \
76+ mediawiki::' " $WIKI_URL " ' mw_dir_clone &&
77+ test_cmp mw_dir_clone/Bar.txt mw_dir/Bar.txt
78+ '
79+
6180test_expect_success ' git push & pull work with locally renamed media files' '
6281 wiki_reset &&
6382 git clone mediawiki::' " $WIKI_URL " ' mw_dir &&
Original file line number Diff line number Diff line change @@ -289,7 +289,6 @@ start_lighttpd () {
289289# Kill daemon lighttpd and removes files and folders associated.
290290stop_lighttpd () {
291291 test -f " $WEB_TMP /pid" && kill $( cat " $WEB_TMP /pid" )
292- rm -rf " $WEB "
293292}
294293
295294# Create the SQLite database of the MediaWiki. If the database file already
@@ -415,6 +414,7 @@ wiki_reset () {
415414wiki_delete () {
416415 if test $LIGHTTPD = " true" ; then
417416 stop_lighttpd
417+ rm -fr " $WEB "
418418 else
419419 # Delete the wiki's directory.
420420 rm -rf " $WIKI_DIR_INST /$WIKI_DIR_NAME " ||
You can’t perform that action at this time.
0 commit comments