mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-11-04 08:10:28 +09:00
파일을 업로드할 때 청크별로 개별 저장하는 대신 파일 하나에 저장하도록 변경
This commit is contained in:
1 parent
c2874035ba
commit
7f68f6d580
10 files changed
+105
-121
No files matched your search
@@ -2,7 +2,6 @@ import { error, text } from "@sveltejs/kit";
|
||||
import { Readable } from "stream";
|
||||
import type { ReadableStream } from "stream/web";
|
||||
import { z } from "zod";
|
||||
import { parseContentDigestHeader } from "$lib/modules/http";
|
||||
import { authorize } from "$lib/server/modules/auth";
|
||||
import { uploadChunk } from "$lib/server/services/upload";
|
||||
import type { RequestHandler } from "./$types";
|
||||
@@ -19,10 +18,7 @@ export const POST: RequestHandler = async ({ locals, params, request }) => {
|
||||
if (!zodRes.success) error(400, "Invalid path parameters");
|
||||
const { id: sessionId, index: chunkIndex } = zodRes.data;
|
||||
|
||||
const encContentHash = parseContentDigestHeader(request.headers.get("Content-Digest"));
|
||||
if (!encContentHash) {
|
||||
error(400, "Invalid request headers");
|
||||
} else if (!request.body) {
|
||||
if (!request.body) {
|
||||
error(400, "Invalid request body");
|
||||
}
|
||||
|
||||
@@ -31,7 +27,6 @@ export const POST: RequestHandler = async ({ locals, params, request }) => {
|
||||
sessionId,
|
||||
chunkIndex,
|
||||
Readable.fromWeb(request.body as ReadableStream),
|
||||
encContentHash,
|
||||
);
|
||||
return text("Chunk uploaded", { headers: { "Content-Type": "text/plain" } });
|
||||
};
|
||||
Reference in new issue
Block a user