( attachments: InboundAttachment[], )
| 122 | * @path refs. Empty string if none resolved. |
| 123 | */ |
| 124 | export async function resolveInboundAttachments( |
| 125 | attachments: InboundAttachment[], |
| 126 | ): Promise<string> { |
| 127 | if (attachments.length === 0) return '' |
| 128 | debug(`resolving ${attachments.length} attachment(s)`) |
| 129 | const paths = await Promise.all(attachments.map(resolveOne)) |
| 130 | const ok = paths.filter((p): p is string => p !== undefined) |
| 131 | if (ok.length === 0) return '' |
| 132 | // Quoted form — extractAtMentionedFiles truncates unquoted @refs at the |
| 133 | // first space, which breaks any home dir with spaces (/Users/John Smith/). |
| 134 | return ok.map(p => `@"${p}"`).join(' ') + ' ' |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Prepend @path refs to content, whichever form it's in. |
no test coverage detected