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 tonull
instead of an empty string. Then when sending a request to validate the diff,
ourValidateDiffModelwould build the request URL by prepending the
localSitePrefixto aapi/validation/diffs/URI. So when the
localSitePrefixisnullthis 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 isnullwhen building the URL. This is consistent with
the way we handle thelocalSitePrefixfor 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 |
|---|---|
| 62f7d8c80d7ea56dacdd2864363bef0792cdc3cb |