Here is a part of my code:
Uri branches = new Uri(@"https://127.0.0.1:8443/svn/CXB1/Validation/branches");
Uri testBranch = new Uri(branches, "test");
I expect testBranches
will be https://127.0.0.1:8443/svn/CXB1/Validation/branches/test
, but it is https://127.0.0.1:8443/svn/CXB1/Validation/test
. I can not understand why Uri(Uri, string) constructor eats the last part of the path.
Add a slash after branches
Uri branches = new Uri(@"https://127.0.0.1:8443/svn/CXB1/Validation/branches/");
Uri testBranch = new Uri(branches, "test");
The Behaviour you see is correct, because replacing the last part is a good idea if you want to change the filename.
I would add the backslash at the end of the first part. Then it is clear that this is a directory, otherwise it may be interpretated as a file.
Uri branches = new Uri(@"https://127.0.0.1:8443/svn/CXB1/Validation/branches/");
Uri testBranch = new Uri(branches, "test");
Console.WriteLine(testBranch);
Will get this output:
https://127.0.0.1:8443/svn/CXB1/Validation/branches/test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With