Issues
                                
                                 Issues copied to clipboard
                                
                                    Issues copied to clipboard
                            
                            
                            
                        Saving a malformed Git URL on the VCS page causes CaC project to become inaccessible
Team
- [X] I've assigned a team label to this issue
Severity
1+ customer
Version
Tested in 2022.4.8167
Latest Version
No response
What happened?
Changing the Git Repository value to something other than a properly formed URL (e.g. https://github.com/thing.git to ThisIsNotAURL) causes the entire project to be inaccessible. This includes the VCS page to change the project settings back.
There should either be some extra validation here that disallows saving a Git Repository url that will not/cannot work, or the VCS page should remain accessible regardless.
Reproduction
- Connect a project to VCS
- Go back into Git Repository on the VCS page and change to something other than a URL, re-enter authentication and save:
 
- See Error when navigating to project on any endpoint:
 
Error and Stacktrace
System.UriFormatException: Invalid URI: The format of the URI could not be determined.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
   at System.Uri..ctor(String uriString)
   at Octopus.Core.Git.Repositories.GitRepositoryKey.BuildRepositoryDirectoryName() in ./source/Octopus.Core/Git/Repositories/GitRepositoryKey.cs:line 51
   at Octopus.Core.Git.Repositories.GitRepositoryKey.BuildRepositoryDirectoryPath(String workingDirectory) in ./source/Octopus.Core/Git/Repositories/GitRepositoryKey.cs:line 25
   at Octopus.Core.Git.Repositories.GitRepositoryFactory.<>c__DisplayClass10_0.<GetOrCreate>b__0(GitRepositoryKey _) in ./source/Octopus.Core/Git/Repositories/GitRepositoryFactory.cs:line 66
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Octopus.Core.Threading.MultiReaderLock.GetReaderLockAndExecute[T](Func`1 func) in ./source/Octopus.Core/Threading/MultiReaderLock.cs:line 38
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass0_0`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters, Object& decoratorTarget)
More Information
No response
Workaround
Use API script to post back a valid URL into the persistence settings of the project JSON.