diff --git a/scripts/lib/upyun_remove.lua b/scripts/lib/upyun_remove.lua index c9fdd0c..be3fe70 100644 --- a/scripts/lib/upyun_remove.lua +++ b/scripts/lib/upyun_remove.lua @@ -34,7 +34,8 @@ function upyun_remove.remove(filepath, filename, retry) local bucket = ngx.var.upyun_bucket local directory = ngx.var.upyun_directory if not filename then - filename = strip_path.strip_path(filepath) + --filename = strip_path.strip_path(filepath) + filename = filepath end ngx.log(ngx.INFO, 'bucket -> ', bucket) diff --git a/scripts/test_upyun_upload.lua b/scripts/test_upyun_upload.lua index a87fb14..1e5c937 100644 --- a/scripts/test_upyun_upload.lua +++ b/scripts/test_upyun_upload.lua @@ -53,6 +53,6 @@ local function upyun_remove_file() end ---upyun_upload_file() +upyun_upload_file() -upyun_remove_file() \ No newline at end of file +--upyun_remove_file() \ No newline at end of file diff --git a/scripts/upyun_remove.lua b/scripts/upyun_remove.lua index dc0088f..ee9f834 100644 --- a/scripts/upyun_remove.lua +++ b/scripts/upyun_remove.lua @@ -11,7 +11,8 @@ local sudoerToken = ngx.req.get_headers().HtySudoerToken ngx.req.read_body() local request_body = ngx.req.get_body_data() local request_body_json = cjson.decode(request_body) -local upyun_remove_url = request_body_json["request_url"] +--local upyun_remove_url = request_body_json["request_url"] +local upyun_remove_url = request_body_json["filename"] ngx.log(ngx.INFO, 'upyun_remove_url -> ', upyun_remove_url) verify(httpc, authHeader, sudoerToken) @@ -20,7 +21,9 @@ ngx.log(ngx.INFO, 'REMOVE UPYUN FILE -> start') local upyun_upload = require("lib.upyun_remove") ngx.log(ngx.INFO, 'REMOVE UPYUN FILE -> upyun_remove loaded') -local file_to_remove = string.match(upyun_remove_url, ".*/(.*)") +--local file_to_remove = string.match(upyun_remove_url, ".*/(.*)") +--local file_to_remove = string.match(upyun_remove_url, ".+/([^/]+)$") +local file_to_remove = upyun_remove_url ngx.log(ngx.INFO, 'REMOVE UPYUN FILE -> file to remove -> ', file_to_remove) --local file_dir = ngx.var.tmp_file_dir