Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
VSOHandler fallback to use raw remote url as repo url when session to…
Browse files Browse the repository at this point in the history
…ken is not available.
  • Loading branch information
Xiaomin Wu committed Oct 20, 2015
1 parent 6de8241 commit cb4de60
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Kudu.Services/ServiceHookHandlers/VSOHandler.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Web;
using Kudu.Contracts.Settings;
using Kudu.Contracts.Tracing;
using Kudu.Core.Deployment;
using Kudu.Core.SourceControl;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -46,11 +44,19 @@ protected virtual GitDeploymentInfo GetDeploymentInfo(HttpRequestBase request, J
// even it is empty password we need to explicitly say so (with colon).
// without colon, LibGit2Sharp is not working
Uri remoteUrl = new Uri(_settings.GetValue("RepoUrl"));
info.RepositoryUrl = string.Format(CultureInfo.InvariantCulture, "{0}://{1}:@{2}{3}",
remoteUrl.Scheme,
sessionToken.Value<string>("token"),
remoteUrl.Authority,
remoteUrl.PathAndQuery);
if (sessionToken == null)
{
// if there is no session token, fallback to use raw remoteUrl from setting.xml
info.RepositoryUrl = remoteUrl.AbsoluteUri;
}
else
{
info.RepositoryUrl = string.Format(CultureInfo.InvariantCulture, "{0}://{1}:@{2}{3}",
remoteUrl.Scheme,
sessionToken.Value<string>("token"),
remoteUrl.Authority,
remoteUrl.PathAndQuery);
}

info.TargetChangeset = DeploymentManager.CreateTemporaryChangeSet(
authorName: info.Deployer,
Expand Down

0 comments on commit cb4de60

Please sign in to comment.