Download the files posted in a Ping or Campfire
Written by @thehalebot
What
attachments list and attachments download now return the files posted in a Ping or a Campfire. A chat upload line (Chat::Lines::Upload) lists its files in an attachments array beside its content, each with a download_url, and the commands read that array as well as the <bc-attachment> tags in rich text. A Ping line URL (/circles/<ping>@<line>) and a Campfire line URL (/buckets/<p>/chats/<c>@<line>) both work.
Why
The CLI couldn't download a file someone posted in a Ping or a Campfire. An agent sent a screenshot or a screen recording in chat therefore couldn't pass it on, for example by attaching it to a bug card. With CLI 0.27.0, attachments download on such a line said "No downloadable attachments found", although the line lists the file with its download URL.
Card: https://app.basecamp.com/2914079/buckets/48521764/card_tables/cards/10563076254
Testing
- A Ping line's file downloads.
TestAttachmentsDownloadSavesPingLineFilesfails onmainwith the card's error and passes here. - A Campfire line's file downloads.
TestAttachmentsDownloadSavesCampfireLineFilesdoes the same. - Other recording types are unchanged: only an upload line's
attachmentsarray is read, so a text line that carries one gains no attachments.TestAttachmentsListLeavesOutTextLineMetadatacovers this. - Against a real Ping, both URL forms downloaded the posted PNG intact.
-
bin/cipasses