Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue with "+" in the filename, issue #13 #20

Merged
merged 1 commit into from
Sep 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ngx_http_zip_parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions t/nginx/html/file1 with space + plus.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the first file.
2 changes: 2 additions & 0 deletions t/nginx/html/zip-spaces-plus.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1a6349c5 24 /file1%20with%20space%20%2B%20plus.txt file1.txt
5d70c4d3 25 /file2.txt file2.txt
9 changes: 8 additions & 1 deletion t/ziptest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# TODO tests for Zip64

use Test::More tests => 84;
use Test::More tests => 88;
use LWP::UserAgent;
use Archive::Zip;

Expand Down Expand Up @@ -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;
Expand Down