From 0b72d86a8bdee84e14ced120aff050c5db55a94d Mon Sep 17 00:00:00 2001 From: RickieL Date: Mon, 10 Sep 2018 22:11:40 +0800 Subject: [PATCH] fixed rewrite regex Curly Bracket case. fix the case that "Curly Bracket" in the rewrite case below: `rewrite "^/a/([\d]{2})_(\d+).html$" /a/0$1/$1$2.html last;` --- nginxfmt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nginxfmt.py b/nginxfmt.py index 0ed26d1..418b348 100755 --- a/nginxfmt.py +++ b/nginxfmt.py @@ -66,6 +66,8 @@ def clean_lines(orig_lines) -> list: else: if line.startswith("#"): cleaned_lines.append(strip_variable_template_tags(line)) + elif line.startswith("rewrite"): + cleaned_lines.append(strip_variable_template_tags(line)) else: cleaned_lines.extend( [strip_variable_template_tags(l).strip() for l in re.split(r"([{}])", line) if l != ""])