From 92d23ce9556b219af4a01f2a981694bc2e06f437 Mon Sep 17 00:00:00 2001 From: izzy Date: Thu, 18 Dec 2025 14:40:59 +0000 Subject: [PATCH] fix: use plain read stream instead of real --- server/src/repositories/storage.repository.ts | 4 ++++ server/src/services/integrity.service.ts | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/src/repositories/storage.repository.ts b/server/src/repositories/storage.repository.ts index e901273b57..3bb9ec5bfe 100644 --- a/server/src/repositories/storage.repository.ts +++ b/server/src/repositories/storage.repository.ts @@ -93,6 +93,10 @@ export class StorageRepository { return { stream: archive, addFile, finalize }; } + createPlainReadStream(filepath: string): Readable { + return createReadStream(filepath); + } + async createReadStream(filepath: string, mimeType?: string | null): Promise { const { size } = await fs.stat(filepath); await fs.access(filepath, constants.R_OK); diff --git a/server/src/services/integrity.service.ts b/server/src/services/integrity.service.ts index e2ef25fc0f..cc1684da52 100644 --- a/server/src/services/integrity.service.ts +++ b/server/src/services/integrity.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; import { createHash } from 'node:crypto'; -import { createReadStream } from 'node:fs'; import { basename } from 'node:path'; import { Readable, Writable } from 'node:stream'; import { pipeline } from 'node:stream/promises'; @@ -519,7 +518,7 @@ export class IntegrityService extends BaseService { const hash = createHash('sha1'); await pipeline([ - createReadStream(originalPath), + this.storageRepository.createPlainReadStream(originalPath), new Writable({ write(chunk, _encoding, callback) { hash.update(chunk); @@ -593,7 +592,7 @@ export class IntegrityService extends BaseService { const hash = createHash('sha1'); await pipeline([ - createReadStream(path), + this.storageRepository.createPlainReadStream(path), new Writable({ write(chunk, _encoding, callback) { hash.update(chunk);