nebula-plugins / gradle-info-plugin

Plugin to gather information about the environment
Apache License 2.0
49 stars 20 forks source link

Handle auth token in git repo url #92

Closed shysteph closed 3 years ago

shysteph commented 3 years ago

If the repo the project is being stored in uses bitbucket cloud and it is checked out with an oauth token such as how jenkins does it the credentials string looks like a regex. This breaks a sanitizing function in GitScmProvider.

For example a url like: https://x-token-auth:{dKkmJHindwdsaw23-dsaHds5-_jjUBF3-S%c9f}@bitbucket.org/some-org/project.git

This change Pattern.quote()'s the http/https credentials when using them as the search string in String.replaceFirst. It also fixes the exception handler for the method so it actually shows the exception message instead of "{0}" when this error occurs. Fix log to show actual error for bad url

DanielThomas commented 3 years ago

Thanks @shysteph - I went with a slightly different approach and verified with our local test. I'll get a patch release out shortly.