Fix bug in uploading diff file from new review request UI.
Review Request #12688 — Created Oct. 18, 2022 and submitted
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'
localSitePrefixattribute to be set to
instead of an empty string. Then when sending a request to validate the diff,
ValidateDiffModelwould build the request URL by prepending the
api/validation/diffs/URI. So when the
nullthis 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
localSitePrefixis replaced with
an empty string if it is
nullwhen building the URL. This is consistent with
the way we handle the
localSitePrefixfor URL building in our other
- 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.