mirror of
https://github.com/immich-app/immich.git
synced 2026-03-23 01:38:58 +03:00
refactor: move code out of try {} block
Signed-off-by: izzy <me@insrt.uk>
This commit is contained in:
@@ -497,9 +497,9 @@ export class IntegrityService extends BaseService {
|
||||
for await (const { originalPath, checksum, createdAt, assetId, reportId } of assets) {
|
||||
processed++;
|
||||
|
||||
try {
|
||||
const hash = createHash('sha1');
|
||||
const hash = createHash('sha1');
|
||||
|
||||
try {
|
||||
await pipeline([
|
||||
this.storageRepository.createPlainReadStream(originalPath),
|
||||
new Writable({
|
||||
@@ -571,9 +571,9 @@ export class IntegrityService extends BaseService {
|
||||
return reportId;
|
||||
}
|
||||
|
||||
try {
|
||||
const hash = createHash('sha1');
|
||||
const hash = createHash('sha1');
|
||||
|
||||
try {
|
||||
await pipeline([
|
||||
this.storageRepository.createPlainReadStream(path),
|
||||
new Writable({
|
||||
@@ -583,15 +583,15 @@ export class IntegrityService extends BaseService {
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
||||
if (Buffer.from(checksum, 'hex').equals(hash.digest())) {
|
||||
return reportId;
|
||||
}
|
||||
} catch (error) {
|
||||
if ((error as { code?: string }).code === 'ENOENT') {
|
||||
return reportId;
|
||||
}
|
||||
}
|
||||
|
||||
if (Buffer.from(checksum, 'hex').equals(hash.digest())) {
|
||||
return reportId;
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user