Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Development #300

Merged
merged 3 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 7 additions & 1 deletion backend/web-bff/App/util/handleMultipart.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ function handleMultipart(req, res, next) {

bb.on('file', (name, file, info) => {
const {filename, encoding, mimetype} = info;
const buffers = [];
file.on('data', (data) => {
form.append(name, data, {filename, contentType: mimetype});
buffers.push(data);
});

file.on('end', () => {
const buffer = Buffer.concat(buffers);
form.append(name, buffer, { filename, contentType: mimetype });
});
});

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/project/components/SubmissionsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const SubmissionsTable: FC<{ submissions: ProjectSubmissionsType[] | null; onCha

const downloadSubmission = async (submission: ProjectSubmissionsType) => {
if (!submission.submission) return console.error("No submission found");
downloadFile(submission.submission.fileUrl, submission.group.name + ".zip");
downloadFile(submission.submission.fileUrl.replace("/api/", "/web/api/") as ApiRoutes.SUBMISSION_FILE, submission.group.name + ".zip");
if (withArtifacts && submission.submission.artifactUrl) {
downloadFile(submission.submission.artifactUrl, submission.group.name + "-artifacts.zip");
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/submission/components/SubmissionCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Card, theme, Button, Space } from "antd"
import { useTranslation } from "react-i18next"
import { GET_Responses } from "../../../@types/requests"
import { ApiRoutes } from "../../../@types/requests"
import { GET_Responses,ApiRoutes } from "../../../@types/requests.d"
import { ArrowLeftOutlined, DownloadOutlined } from "@ant-design/icons"
import { useLocation, useNavigate } from "react-router-dom"
import "@fontsource/jetbrains-mono"
Expand All @@ -18,16 +17,17 @@ const SubmissionCard: React.FC<{ submission: SubmissionType }> = ({ submission }
const location = useLocation()
const index = new URLSearchParams(location.search).get("index")


console.log(submission);
const downloadFile = async (route: ApiRoutes.SUBMISSION_FILE | ApiRoutes.SUBMISSION_ARTIFACT, filename: string) => {

const response = await API.GET(
route,
route.replace("/api/","/web/api/") as ApiRoutes.SUBMISSION_FILE,
{
config: {
responseType: "blob",
transformResponse: [(data) => data],
},

},
"message"
)
Expand Down
Loading