Update chat integrations to account for new download URLs when showing file attachment images in messages.

Review Request #13807 — Created May 1, 2024 and submitted — Latest diff uploaded

Information

rbintegrations
release-4.x

Reviewers

We recently updated our file attachments to have a dedicated, stable URL for
downloads instead of pointing directly to the raw file URL. However, this means
that URL (FileAttachment.get_absolute_url()) no longer includes the file
extension in it.

When deciding whether to include an image of a file attachment in a message,
our chat integrations would check for file extensions in the file attachment
URLs included in a change description. Since we no longer include file
extensions in these URLs, this updates our chat integrations to grab the
file extensions from the filename.

I audited the rest of the RB Integrations, Review Board, RBTools, and
Review Bot codebases to see if we make this same assumption anywhere else,
and didn't find anything.

  • Ran unit tests with RB6 and RB7.
  • Manually tested causing chat notifications for review requests
    with an image file attachment (causing an image to appear).
  • Manually tested causing chat notifications for review requests
    with a text file attachment or no file attachments (causing
    no images to appear)

Commits

Files