Skip to content

Commit fd43f3f

Browse files
committed
fixes
1 parent b2173b6 commit fd43f3f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

bota/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def get_description():
5454
#
5555
# This field corresponds to the "Description" metadata field:
5656
# https://packaging.python.org/specifications/core-metadata/#description-optional
57-
version='4.0.102',
57+
version='4.0.104',
5858
author="Chetan Jain",
5959
author_email="53407137+Chetan11-dev@users.noreply.github.com",
6060
description="CLI for botasaurus.",

bota/src/bota/vm.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,10 @@ def clean_conf(apache_conf, root_path):
610610
# return apache_conf
611611
return re.sub(r'[ \t]+</VirtualHost>', '</VirtualHost>', apache_conf)
612612

613+
def collapse_empty_lines(conf: str) -> str:
614+
# Replace multiple consecutive newlines (with optional whitespace) with a single newline
615+
return re.sub(r'\n\s*\n+', '\n\n', conf.strip()) + '\n'
616+
613617
def sub_at_start(apache_conf, root_path, api_target):
614618
return re.sub(
615619
r'(<VirtualHost\b.*?>)',
@@ -628,10 +632,10 @@ def make_apache_content(apache_conf, root_path, api_target):
628632

629633
# Add new ProxyPass and ProxyPassReverse directives based on the root_path
630634
if root_path == "/":
631-
return remove_empty_lines(sub_at_end(apache_conf, root_path, api_target))
635+
return collapse_empty_lines(sub_at_end(apache_conf, root_path, api_target))
632636
else:
633637
# Add new directives right after the VirtualHost opening tag
634-
return remove_empty_lines(sub_at_start(apache_conf, root_path, api_target))
638+
return collapse_empty_lines(sub_at_start(apache_conf, root_path, api_target))
635639

636640
def setup_apache_load_balancer_desktop_app(port, api_base_path):
637641
root_path = api_base_path or '/'

0 commit comments

Comments
 (0)