Skip to content

Commit

Permalink
Merge pull request #300 from SELab-2/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Aqua-sc authored May 23, 2024
2 parents dffe45c + 8691428 commit 866eb46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
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

0 comments on commit 866eb46

Please sign in to comment.