Download the files posted in a Ping or Campfire

TH
3d ago
+121-6

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. TestAttachmentsDownloadSavesPingLineFiles fails on main with the card's error and passes here.
  • A Campfire line's file downloads. TestAttachmentsDownloadSavesCampfireLineFiles does the same.
  • Other recording types are unchanged: only an upload line's attachments array is read, so a text line that carries one gains no attachments. TestAttachmentsListLeavesOutTextLineMetadata covers this.
  • Against a real Ping, both URL forms downloaded the posted PNG intact.
  • bin/ci passes