Fixed Dokubox and Sanitizing for File Uploads Fix #133
This commit is contained in:
@@ -27,6 +27,10 @@ export function syncDokuboxService (server: FastifyInstance) {
|
||||
let client: ImapFlow | null = null
|
||||
|
||||
async function initDokuboxClient() {
|
||||
if (client?.usable) {
|
||||
return client
|
||||
}
|
||||
|
||||
client = new ImapFlow({
|
||||
host: secrets.DOKUBOX_IMAP_HOST,
|
||||
port: secrets.DOKUBOX_IMAP_PORT,
|
||||
@@ -41,6 +45,7 @@ export function syncDokuboxService (server: FastifyInstance) {
|
||||
console.log("Dokubox E-Mail Client Initialized")
|
||||
|
||||
await client.connect()
|
||||
return client
|
||||
}
|
||||
|
||||
const syncDokubox = async () => {
|
||||
@@ -92,7 +97,8 @@ export function syncDokuboxService (server: FastifyInstance) {
|
||||
if (!badMessageMessageSent) {
|
||||
badMessageMessageSent = true
|
||||
}
|
||||
return
|
||||
server.log.warn({ messageId: message.id, subject: message.subject }, "Dokubox message could not be mapped to a tenant")
|
||||
continue
|
||||
}
|
||||
|
||||
if (message.attachments.length > 0) {
|
||||
@@ -248,7 +254,6 @@ export function syncDokuboxService (server: FastifyInstance) {
|
||||
|
||||
return {
|
||||
run: async () => {
|
||||
await initDokuboxClient()
|
||||
await syncDokubox()
|
||||
console.log("Service: Dokubox sync finished")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user