Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/pages/EditorComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ const WelcomeText = styled("span")(({ theme }) => ({
fontWeight: "bold",
}));

const decodeFormat = (data) => {
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name decodeFormat is ambiguous. Consider renaming it to decodeBase64Output or parseBase64Response to clearly indicate it decodes base64-encoded data and formats it as an array of lines.

Suggested change
const decodeFormat = (data) => {
const decodeBase64Output = (data) => {

Copilot uses AI. Check for mistakes.

return data?atob(data).split("\n"):[];
}

function EditorComponent() {
const [code, setCode] = useState(null);
const [output, setOutput] = useState([]);
Expand Down Expand Up @@ -192,12 +196,15 @@ function EditorComponent() {
.then((data) => {
if (!data.stdout) {
enqueueSnackbar("Please check the code", { variant: "error" });
setOutput(data.message);
if (data.stderr) {
setOutput(decodeFormat(data.stderr));
}
else if (data.compile_output) {
setOutput(decodeFormat(data.compile_output));
}
return;
}
const decodedOutput = atob(data.stdout);
const formattedData = decodedOutput.split("\n");
setOutput(formattedData);
setOutput(decodeFormat(data.stdout));
})
.catch((error) => {
enqueueSnackbar("Error retrieving output: " + error.message, {
Expand Down