Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
feat: skips assets with 100MB binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
Enngage committed Jan 22, 2020
1 parent a1277d2 commit c6d64d2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/import/import.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { IBinaryFile, IImportConfig, IImportSource } from './import.models';
export class ImportService {
private readonly defaultLanguageId: string = '00000000-0000-0000-0000-000000000000';
private readonly client: IManagementClient;
private readonly maxAllowedAssetSizeInBytes: number = 1e+8;

constructor(private config: IImportConfig) {
this.client = new ManagementClient({
Expand Down Expand Up @@ -278,6 +279,11 @@ export class ImportService {
throw Error(`Could not find binary file for asset with id '${asset.id}'`);
}

if (binaryFile.asset.size >= this.maxAllowedAssetSizeInBytes) {
console.log('Skipping file due to size: ', asset.file_name);
continue;
}

const uploadedBinaryFile = await this.client
.uploadBinaryFile()
.withData({
Expand Down

0 comments on commit c6d64d2

Please sign in to comment.