From 6d23605227c578d570e5594931720f85a1af55a2 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Thu, 24 Mar 2022 19:30:26 +0100 Subject: [PATCH] main: set filename of attachments --- main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 14c932c3..3d2e1ace 100644 --- a/main.js +++ b/main.js @@ -3,6 +3,7 @@ const core = require("@actions/core") const glob = require("@actions/glob") const fs = require("fs") const showdown = require("showdown") +const path = require("path") function getBody(bodyOrFile, convertMarkdown) { let body = bodyOrFile @@ -33,7 +34,7 @@ function getFrom(from, username) { async function getAttachments(attachments) { const globber = await glob.create(attachments.split(',').join('\n')) const files = await globber.glob() - return files.map(f => ({ path: f, cid: f.replace(/^.*[\\\/]/, '')})) + return files.map(f => ({ filename: path.basename(f), path: f, cid: f.replace(/^.*[\\\/]/, '')})) } async function main() {