mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix: use plain read stream instead of real
This commit is contained in:
@@ -93,6 +93,10 @@ export class StorageRepository {
|
|||||||
return { stream: archive, addFile, finalize };
|
return { stream: archive, addFile, finalize };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createPlainReadStream(filepath: string): Readable {
|
||||||
|
return createReadStream(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
async createReadStream(filepath: string, mimeType?: string | null): Promise<ImmichReadStream> {
|
async createReadStream(filepath: string, mimeType?: string | null): Promise<ImmichReadStream> {
|
||||||
const { size } = await fs.stat(filepath);
|
const { size } = await fs.stat(filepath);
|
||||||
await fs.access(filepath, constants.R_OK);
|
await fs.access(filepath, constants.R_OK);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { createHash } from 'node:crypto';
|
import { createHash } from 'node:crypto';
|
||||||
import { createReadStream } from 'node:fs';
|
|
||||||
import { basename } from 'node:path';
|
import { basename } from 'node:path';
|
||||||
import { Readable, Writable } from 'node:stream';
|
import { Readable, Writable } from 'node:stream';
|
||||||
import { pipeline } from 'node:stream/promises';
|
import { pipeline } from 'node:stream/promises';
|
||||||
@@ -519,7 +518,7 @@ export class IntegrityService extends BaseService {
|
|||||||
const hash = createHash('sha1');
|
const hash = createHash('sha1');
|
||||||
|
|
||||||
await pipeline([
|
await pipeline([
|
||||||
createReadStream(originalPath),
|
this.storageRepository.createPlainReadStream(originalPath),
|
||||||
new Writable({
|
new Writable({
|
||||||
write(chunk, _encoding, callback) {
|
write(chunk, _encoding, callback) {
|
||||||
hash.update(chunk);
|
hash.update(chunk);
|
||||||
@@ -593,7 +592,7 @@ export class IntegrityService extends BaseService {
|
|||||||
const hash = createHash('sha1');
|
const hash = createHash('sha1');
|
||||||
|
|
||||||
await pipeline([
|
await pipeline([
|
||||||
createReadStream(path),
|
this.storageRepository.createPlainReadStream(path),
|
||||||
new Writable({
|
new Writable({
|
||||||
write(chunk, _encoding, callback) {
|
write(chunk, _encoding, callback) {
|
||||||
hash.update(chunk);
|
hash.update(chunk);
|
||||||
|
|||||||
Reference in New Issue
Block a user