fix: Escape backticks in error text using Unicode sequence
This commit is contained in:
parent
c162248348
commit
48f03f89f9
@ -526,11 +526,14 @@ if st.session_state.error_log:
|
|||||||
copy_button = st.button("Copy Error Log")
|
copy_button = st.button("Copy Error Log")
|
||||||
if copy_button:
|
if copy_button:
|
||||||
# Create a JavaScript function to copy the text
|
# Create a JavaScript function to copy the text
|
||||||
|
# Escape any backticks in the error text first
|
||||||
|
escaped_error_text = error_text.replace('`', '\u0060')
|
||||||
|
|
||||||
js_code = f"""
|
js_code = f"""
|
||||||
<script>
|
<script>
|
||||||
// Create a temporary textarea element
|
// Create a temporary textarea element
|
||||||
const textarea = document.createElement('textarea');
|
const textarea = document.createElement('textarea');
|
||||||
textarea.value = `{error_text.replace('`', '\\`')}`; // Escape backticks
|
textarea.value = `{escaped_error_text}`;
|
||||||
document.body.appendChild(textarea);
|
document.body.appendChild(textarea);
|
||||||
|
|
||||||
// Select and copy the text
|
// Select and copy the text
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user