Fix bug in uploading diff file from new review request UI.

Review Request #12688 — Created Oct. 18, 2022 and submitted

Information

Review Board
release-5.0.x

Reviewers

A bug was discovered on the New Review Request page where using the
repositories search bar to filter the repositories and then selecting one would
break uploading diff files. Instead of being redirected to the review request
draft page after uploading a diff, the page would not redirect and the uploader
would just display a loading spinner. This happens because using the search bar
causes the repositories' localSitePrefix attribute to be set to null
instead of an empty string. Then when sending a request to validate the diff,
our ValidateDiffModel would build the request URL by prepending the
localSitePrefix to a api/validation/diffs/ URI. So when the
localSitePrefix is null this would result in a request being made to the
nullapi/validation/diffs/ URL, which does not exist.

This change fixes this by making sure the localSitePrefix is replaced with
an empty string if it is null when building the URL. This is consistent with
the way we handle the localSitePrefix for URL building in our other
Javascript models.

  • Manually tested uploading diff files with and without using the search bar
    to filter the repositories.
  • Added a JS unit test for this and ran all JS unit tests.
Summary ID
Fix bug in uploading diff file from new review request UI.
62f7d8c80d7ea56dacdd2864363bef0792cdc3cb
chipx86
  1. Ship It!
  2. 
      
david
  1. Ship It!
  2. 
      
maubin
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (7d89095)
Loading...