Fix download-file-attachment URL for attachments on a local site.
Review Request #14226 — Created Nov. 4, 2024 and submitted
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
thatget_absolute_url()
does the right thing.
- Was able to view a review request with attachments on the new RBC
server. - Ran unit tests.
Summary | ID |
---|---|
5a873f9bda3b39edde9e8177e154a34f8cea0f91 |
Description | From | Last Updated |
---|---|---|
It would be nice if we could just update the "getter" for the local_site property to return self.local_site if its … |
maubin |
-
-
It would be nice if we could just update the "getter" for the
local_site
property to returnself.local_site
if its a user file attachment, andreview_request.local_site
otherwise. That way callers don't have to remember which one to use and can just callself.local_site
directly. But I don't think there's a way to safely do that.Would it be a good idea to make a
get_local_site()
method and put that logic in there? Similar to how we have aget_review_request()
one.