diff --git a/src/attachment.ts b/src/attachment.ts index a0f1978c..8666c5dd 100644 --- a/src/attachment.ts +++ b/src/attachment.ts @@ -1,7 +1,7 @@ +// Copyright 2024 Cisco Systems, Inc. +// Licensed under MIT-style license (see LICENSE.txt file). + import * as core from '@actions/core' -import * as exec from '@actions/exec' -import * as os from 'os' -import * as path from 'path' import {Activity} from './activity' import {Dimensions} from './dimensions' @@ -10,8 +10,6 @@ import {Parser} from './parser' import {Reference} from '../dev/@types/Reference.d' import {SortedKeyValueArray} from '../dev/@types/SortedKeyValueArray.d' -import sizeOf from 'image-size' - export interface Attachment { uniformTypeIdentifier: string name?: string @@ -34,49 +32,8 @@ export async function exportAttachments( activity.attachments = activity.attachments || [] if (activity.attachments) { - for (const attachment of activity.attachments) { - if (attachment.filename && attachment.payloadRef) { - const outputPath = path.join(os.tmpdir(), attachment.filename) - const image = await parser.exportObject( - attachment.payloadRef.id, - outputPath - ) - - let output = '' - const options = { - silent: true, - listeners: { - stdout: (data: Buffer) => { - output += data.toString() - } - } - } - - try { - const dimensions: Dimensions = sizeOf(image) - attachment.dimensions = dimensions - - if (image && core.getInput('token')) { - await exec.exec( - 'curl', - [ - '-X', - 'POST', - 'https://xcresulttool-file.herokuapp.com/file', - '-d', - image.toString('base64') - ], - options - ) - const response = JSON.parse(output) - if (response) { - attachment.link = response.link - } - } - } catch { - // no-op - } - } - } + core.debug( + `Attachments in activity '${activity.title}' will not be exported.` + ) } }