fix: process code input to handle newlines and tabs correctly; update CSS for better text wrapping
This commit is contained in:
@@ -457,13 +457,18 @@ const CodeChallenge = () => {
|
||||
try {
|
||||
// Submit code to the backend
|
||||
const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8080';
|
||||
|
||||
// Ensure code has actual newlines, not escaped \n strings
|
||||
// This handles cases where code might have literal "\n" instead of newlines
|
||||
const processedCode = code.replace(/\\n/g, '\n').replace(/\\t/g, '\t');
|
||||
|
||||
const response = await fetch(`${apiUrl}/api/submit`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
code: code,
|
||||
code: processedCode,
|
||||
language: getLanguageIdentifier(language),
|
||||
input: '',
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user