dangogh closed pull request #3080: Fixed configuration file sanitization
URL: https://github.com/apache/trafficcontrol/pull/3080
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py 
b/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py
index fd82c233b..3e52db334 100644
--- a/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py
+++ b/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/config_files.py
@@ -262,7 +262,7 @@ def sanitizeContents(raw:str) -> str:
        # to use curly brace-enclosed text as a key into a dictonary of its 
arguments. They'll be
        # rendered into single braces in the output of `.format`, leaving the 
string ultimately
        # unchanged in that respect.
-       for line in raw.replace('{', "{{").replace('}', 
"}}").format(SERVER_INFO).splitlines():
+       for line in SERVER_INFO.sanitize(raw).splitlines():
                tmp=(" ".join(line.split())).strip() #squeezes spaces and trims 
leading and trailing spaces
                tmp=tmp.replace("&", '&') #decodes HTML-encoded ampersands
                tmp=tmp.replace(">", '>') #decodes HTML-encoded greater-than 
symbols
diff --git a/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/to_api.py 
b/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/to_api.py
index 5dcd84cd1..73b16c66e 100644
--- a/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/to_api.py
+++ b/infrastructure/cdn-in-a-box/ort/traffic_ops_ort/to_api.py
@@ -94,7 +94,7 @@ def __repr__(self) -> str:
                                       for a in dir(self)\
                                       if not a.startswith('_')))
 
-       def __format__(self, fmt:str) -> str:
+       def sanitize(self, fmt:str) -> str:
                """
                Implements ``str.format(self)``
                """


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to