Spaces:
Runtime error
Runtime error
Commit
·
3fa9dc7
1
Parent(s):
e50acc4
sanitization
Browse files
app.py
CHANGED
@@ -94,9 +94,16 @@ def keygen(eval_key):
|
|
94 |
|
95 |
def safe_eval(encodings):
|
96 |
try:
|
|
|
|
|
|
|
97 |
# Replace newline characters and ensure proper commas are added
|
98 |
sanitized = encodings.replace('\n', ',').replace(' ', ',')
|
99 |
sanitized = sanitized.replace(',,', ',') # Handle potential double commas
|
|
|
|
|
|
|
|
|
100 |
return eval(sanitized)
|
101 |
except SyntaxError:
|
102 |
raise ValueError("Failed to safely parse the encodings string.")
|
|
|
94 |
|
95 |
def safe_eval(encodings):
|
96 |
try:
|
97 |
+
# Debugging: Print the encodings string to understand its format
|
98 |
+
print("Encodings String:", encodings)
|
99 |
+
|
100 |
# Replace newline characters and ensure proper commas are added
|
101 |
sanitized = encodings.replace('\n', ',').replace(' ', ',')
|
102 |
sanitized = sanitized.replace(',,', ',') # Handle potential double commas
|
103 |
+
|
104 |
+
# Debugging: Print the sanitized string
|
105 |
+
print("Sanitized String:", sanitized)
|
106 |
+
|
107 |
return eval(sanitized)
|
108 |
except SyntaxError:
|
109 |
raise ValueError("Failed to safely parse the encodings string.")
|