mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Drawing text annotation now use the new format functions instead of executing arbitrary code.
This commit is contained in:
@@ -1391,8 +1391,9 @@ class Drawing(blenderbim.core.tool.Drawing):
|
|||||||
original_command = command
|
original_command = command
|
||||||
for variable in re.findall("{{.*?}}", command):
|
for variable in re.findall("{{.*?}}", command):
|
||||||
value = ifcopenshell.util.selector.get_element_value(product, variable[2:-2])
|
value = ifcopenshell.util.selector.get_element_value(product, variable[2:-2])
|
||||||
command = command.replace(variable, repr(value))
|
value = '"' + str(value).replace('"', '\\"') + '"'
|
||||||
text = text.replace(original_command, str(eval(command[2:-2])))
|
command = command.replace(variable, value)
|
||||||
|
text = text.replace(original_command, ifcopenshell.util.selector.format(command[2:-2]))
|
||||||
|
|
||||||
for variable in re.findall("{{.*?}}", text):
|
for variable in re.findall("{{.*?}}", text):
|
||||||
value = ifcopenshell.util.selector.get_element_value(product, variable[2:-2])
|
value = ifcopenshell.util.selector.get_element_value(product, variable[2:-2])
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ class IfcCsv:
|
|||||||
if row[index] == null:
|
if row[index] == null:
|
||||||
continue
|
continue
|
||||||
if not isinstance(row[index], str):
|
if not isinstance(row[index], str):
|
||||||
row[index] = '"' + str(row[index]) + '"'
|
row[index] = '"' + str(row[index]).replace('"', '\\"') + '"'
|
||||||
row[index] = ifcopenshell.util.selector.format(format_query.replace("{{value}}", row[index]))
|
row[index] = ifcopenshell.util.selector.format(format_query.replace("{{value}}", row[index]))
|
||||||
|
|
||||||
def sort_results(self, sort, attributes, include_global_id):
|
def sort_results(self, sort, attributes, include_global_id):
|
||||||
|
|||||||
Reference in New Issue
Block a user