Fix download-file-attachment URL for attachments on a local site.

Review Request #14226 — Created Nov. 4, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

FileAttachment has a confusing relation to LocalSite. For historical
reasons, attachments which are related to a review request have a blank
local_site field, using the review request's local site instead. The
local_site field is therefore only "usable" for user file attachments
(such as files which are dropped into a comment box or review request
field).

This was causing a crash for review requests with attachments when
attempting to create the new download URL.

This change adds a fix for the URL crash, a big comment on the
local_site field explaining what's up, and some unit tests to ensure
that get_absolute_url() does the right thing.

  • Was able to view a review request with attachments on the new RBC
    server.
  • Ran unit tests.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Fix download-file-attachment URL for attachments on a local site.
FileAttachment has a confusing relation to LocalSite. For historical reasons, attachments which are related to a review request have a blank `local_site` field, using the review request's local site instead. The `local_site` field is therefore only "usable" for user file attachments (such as files which are dropped into a comment box or review request field). This was causing a crash for review requests with attachments when attempting to create the new download URL. This change adds a fix for the URL crash, a big comment on the `local_site` field explaining what's up, and some unit tests to ensure that `get_absolute_url()` does the right thing. Testing Done: - Was able to view a review request with attachments on the new RBC server. - Ran unit tests.
5a873f9bda3b39edde9e8177e154a34f8cea0f91 David Trowbridge
reviewboard/attachments/models.py
reviewboard/attachments/tests/test_file_attachment.py
reviewboard/attachments/tests/test_user_file_attachment.py
Loading...