Forked from fffonion/nginx-unzip-module_good.patch
Created
November 27, 2016 06:32
-
-
Save eli007s/3c6f35565fedfdcf0dc2000dd65f7bd0 to your computer and use it in GitHub Desktop.
nginx-unzip-module, NODIR, NOCASE mod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ngx_http_unzip_module.c b/ngx_http_unzip_module.c | |
index 771e1dc..00ea0f1 100644 | |
--- a/nginx-unzip-module/ngx_http_unzip_module.c | |
+++ b/nginx-unzip-module/ngx_http_unzip_module.c | |
@@ -224,7 +224,7 @@ static ngx_int_t ngx_http_unzip_handler(ngx_http_request_t *r) | |
zip_stat_init(&zip_st); | |
/* let's check what's the size of a file. return 404 if we can't stat file inside archive */ | |
- if (0 != zip_stat(zip_source, unzipextract_path, 0, &zip_st)) { | |
+ if (0 != zip_stat(zip_source, unzipextract_path, ZIP_FL_NODIR|ZIP_FL_NOCASE, &zip_st)) { | |
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no file %s inside %s archive.", unzipextract_path, unzipfile_path); | |
free(unzipfile_path); | |
free(unzipextract_path); | |
@@ -245,7 +245,7 @@ static ngx_int_t ngx_http_unzip_handler(ngx_http_request_t *r) | |
* try to open a file that we want - if not return 500 as we know that the file is there (making zip_stat before) | |
* so let's return 500. | |
*/ | |
- if (!(file_in_zip = zip_fopen(zip_source, unzipextract_path, 0))) { | |
+ if (!(file_in_zip = zip_fopen(zip_source, unzipextract_path, ZIP_FL_NODIR|ZIP_FL_NOCASE))) { | |
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "failed to open %s from %s archive (corrupted?).", | |
unzipextract_path, unzipfile_path); | |
free(unzipfile_path); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment