Permalink
Browse files

Merge pull request #20 from ncoders/master

Fixed an issue with "+" in the filename, issue #13
  • Loading branch information...
2 parents 6f71b11 + 3c69ff5 commit 35ea7ff3ff198417f85b55ef2acee55f37d9e1fd @evanmiller committed Sep 20, 2013
Showing with 13 additions and 3 deletions.
  1. +2 −2 ngx_http_zip_parsers.c
  2. +1 −0 t/nginx/html/file1 with space + plus.txt
  3. +2 −0 t/nginx/html/zip-spaces-plus.txt
  4. +8 −1 t/ziptest.pl
@@ -49,12 +49,12 @@ destructive_url_decode_len(unsigned char* start, unsigned char* end)
for (; read_pos < end; read_pos++) {
unsigned char ch = *read_pos;
+ if (ch == '+')
+ ch = ' ';
if (ch == '%' && (read_pos+2 < end)) {
ch = 16 * hex_char_value(*(read_pos+1)) + hex_char_value(*(read_pos+2));
read_pos += 2;
}
- if (ch == '+')
- ch = ' ';
*(write_pos++) = ch;
}
@@ -0,0 +1 @@
+This is the first file.
@@ -0,0 +1,2 @@
+1a6349c5 24 /file1%20with%20space%20%2B%20plus.txt file1.txt
+5d70c4d3 25 /file2.txt file2.txt
View
@@ -2,7 +2,7 @@
# TODO tests for Zip64
-use Test::More tests => 84;
+use Test::More tests => 88;
use LWP::UserAgent;
use Archive::Zip;
@@ -137,6 +137,13 @@ ($$)
$zip = test_zip_archive($response->content, "with spaces in URLs");
is($zip->numberOfMembers(), 2, "Correct number in spaced-out ZIP");
+$response = $ua->get("$http_root/zip-spaces-plus.txt");
+is($response->code, 200, "Returns OK with spaces and plus in URLs");
+
+$zip = test_zip_archive($response->content, "with spaces and plus in the URLs");
+is($zip->numberOfMembers(), 2, "Correct number in spaces and plus ZIP");
+
+
open LARGEFILE, ">", "nginx/html/largefile.txt";
for (0..99999) {
print LARGEFILE "X" x 99;

0 comments on commit 35ea7ff

Please sign in to comment.