Skip to content

Commit

Permalink
main: set filename of attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidd6 authored Mar 24, 2022
1 parent f5b1987 commit 6d23605
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 6d23605

Please sign in to comment.