mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-15 22:38:47 +00:00
파일을 업로드할 때, 파일의 내용이 아닌 해시가 서버의 파일 시스템에 기록되던 버그 수정
This commit is contained in:
@@ -112,7 +112,16 @@ export const uploadFile = async (
|
||||
try {
|
||||
const hashStream = createHash("sha256");
|
||||
const [_, hash] = await Promise.all([
|
||||
pipeline(encContentStream, hashStream, createWriteStream(path, { flags: "wx", mode: 0o600 })),
|
||||
pipeline(
|
||||
encContentStream,
|
||||
async function* (source) {
|
||||
for await (const chunk of source) {
|
||||
hashStream.update(chunk);
|
||||
yield chunk;
|
||||
}
|
||||
},
|
||||
createWriteStream(path, { flags: "wx", mode: 0o600 }),
|
||||
),
|
||||
encContentHash,
|
||||
]);
|
||||
if (hashStream.digest("base64") != hash) {
|
||||
|
||||
Reference in New Issue
Block a user