fix: git azure url special char support (#29319)

## Description
Modifies git url regex to add support for special character (%)

#### PR fixes following issue(s)
Fixes #28061 

#### Media
<img width="1728" alt="image"
src="https://github.com/appsmithorg/appsmith/assets/8724051/b6e477fb-1e62-44ab-a724-b963116fceda">


#### Type of change
> Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [x] Jest
- [x] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved URL validation to support Azure repository URLs with encoded
spaces.
- **Refactor**
- Updated regular expression patterns to allow for additional characters
in Git remote URLs, enhancing compatibility with various repository
naming conventions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
This commit is contained in:
Rudraprasad Das 2023-12-06 11:42:09 +05:30 committed by GitHub
parent 18eb6790bf
commit 77575fdae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -29,6 +29,8 @@ const validUrls = [
"git@abcd.org:org__v3/(((something)/(other)/(thing).git",
"git@gitlab-abcd.test.org:org__org/repoName.git",
"git@gitlab__abcd.test.org:org__org/repoName.git",
"git@ssh.dev.azure.com:v3/something/with%20space%20(some)/geo-mantis",
"git@ssh.dev.azure.com:v3/something/with%20space%20some/geo-mantis",
];
const invalidUrls = [

View File

@ -19,7 +19,7 @@ export const getIsStartingWithRemoteBranches = (
};
const GIT_REMOTE_URL_PATTERN =
/^((git|ssh)|(git@[\w\-\.]+))(:(\/\/)?)([\w\.@\:\/\-~\(\)]+)[^\/]$/im;
/^((git|ssh)|(git@[\w\-\.]+))(:(\/\/)?)([\w\.@\:\/\-~\(\)%]+)[^\/]$/im;
const gitRemoteUrlRegExp = new RegExp(GIT_REMOTE_URL_PATTERN);