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