Skip to content

Commit

Permalink
Fix conflict in yarn lock
Browse files Browse the repository at this point in the history
  • Loading branch information
euanmillar committed Dec 9, 2024
1 parent 5c54bc3 commit e0e03e5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
37 changes: 29 additions & 8 deletions packages/documents/src/features/uploadDocument/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,36 @@ export async function documentUploadHandler(
const payload = request.payload as IDocumentPayload
const ref = uuid()
try {
const base64String = payload.fileData.split(',')[1]
const base64Decoded = Buffer.from(base64String, 'base64')
const fileType = (await fromBuffer(base64Decoded)) as IFileInfo
const generateFileName = `${ref}.${fileType.ext}`
// payload is an image
const regex = /^data:image/
let generateFileName
if (regex.test(payload.fileData)) {
const base64String = payload.fileData.split(',')[1]
const base64Decoded = Buffer.from(base64String, 'base64')
const fileType = (await fromBuffer(base64Decoded)) as IFileInfo
generateFileName = `${ref}.${fileType.ext}`

await minioClient.putObject(MINIO_BUCKET, generateFileName, base64Decoded, {
'content-type': fileType.mime,
...payload.metaData
})
await minioClient.putObject(
MINIO_BUCKET,
generateFileName,
base64Decoded,
{
'content-type': fileType.mime,
...payload.metaData
}
)
} else {
// payload is an svg cert
const generateFileName = `${ref}.CERTIFICATE`
await minioClient.putObject(
MINIO_BUCKET,
generateFileName,
payload.fileData,
{
'content-type': 'image/svg+xml'
}
)
}

return h
.response({ refUrl: `/${MINIO_BUCKET}/${generateFileName}` })
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23937,9 +23937,9 @@ typescript@4.9.5, typescript@^4.5:
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==

"typescript@>=3 < 6":
version "5.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==
version "5.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"
integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==

typical@^2.6.1:
version "2.6.1"
Expand Down

0 comments on commit e0e03e5

Please sign in to comment.