Skip to content

Commit

Permalink
chore: fix formating
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuste committed Mar 26, 2024
1 parent 4a8fde0 commit 40450ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 16 additions & 11 deletions plugins/qeta-backend/src/service/routes/attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import S3StoreEngine from '../upload/s3';
import fs from 'fs';
import FileType from 'file-type';
import { File } from '../types';
import { S3Client, GetObjectCommand, GetObjectCommandOutput } from "@aws-sdk/client-s3";
import {
S3Client,
GetObjectCommand,
GetObjectCommandOutput,
} from '@aws-sdk/client-s3';

const DEFAULT_IMAGE_SIZE_LIMIT = 2500000;
const DEFAULT_MIME_TYPES = [
Expand Down Expand Up @@ -117,21 +121,22 @@ export const attachmentsRoutes = (router: Router, options: RouterOptions) => {
const s3 =
accessKeyId && secretAccessKey && region
? new S3Client({
credentials: {
accessKeyId,
secretAccessKey,
},
region,
})
credentials: {
accessKeyId,
secretAccessKey,
},
region,
})
: new S3Client();
const object: GetObjectCommandOutput = await s3
.send(new GetObjectCommand({
const object: GetObjectCommandOutput = await s3.send(
new GetObjectCommand({
Bucket: bucket,
Key: attachment.path,
}));
}),
);

if (object.Body) {
const bytes = await object.Body.transformToByteArray()
const bytes = await object.Body.transformToByteArray();
imageBuffer = Buffer.from(bytes);
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion plugins/qeta-backend/src/service/upload/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Config } from '@backstage/config';
import { QetaStore } from '../../database/QetaStore';
import { Attachment } from '@drodil/backstage-plugin-qeta-common';
import { File } from '../types';
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';

type Options = {
config: Config;
Expand Down

0 comments on commit 40450ca

Please sign in to comment.