Skip to content

Commit

Permalink
fix: build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Nov 17, 2024
1 parent 5052961 commit 8f2f2c8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/api/build/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function POST(request: NextRequest) {
return Response.json({ error: content }, { status: 400 });
}

return Response.json({ dll: await response.text() });
return Response.json({ dll: content });
} else if (files.some((i) => i.path.endsWith(".sol"))) {
const formData = new FormData();
const file = files[0];
Expand Down
12 changes: 12 additions & 0 deletions components/workspace/format-build-errors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function FormatBuildErrors({ inputString }: { inputString?: string }) {
if (!inputString) return "";
// Detect and remove the dynamic path
const cleanedString = inputString.replace(
/\/tmp\/[a-f0-9\-]+\//g,
""
);

return <>
{cleanedString.split("\n").map((line, index) => <p key={index}>{line}</p>)}
</>
}
5 changes: 2 additions & 3 deletions components/workspace/use-cli-commands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useSetSearchParams } from "@/lib/set-search-params";
import { FormatErrors } from "./format-errors";
import { ShareLink } from "./share-link";
import Link from "next/link";
import { FormatBuildErrors } from "./format-build-errors";

const PROPOSAL_TIMEOUT = 15 * 60 * 1000; // proposal expires after 15 minutes

Expand Down Expand Up @@ -153,9 +154,7 @@ export function useCliCommands() {
return;
} else {
terminalContext.setBufferedContent(
<>
<p>{error}</p>
</>
<FormatBuildErrors inputString={error} />
);
return;
}
Expand Down

0 comments on commit 8f2f2c8

Please sign in to comment.