Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 79362ad

Browse files
author
Amy Truong
committed
Merge remote-tracking branch 'github/master' into create-manifest
2 parents eef4d28 + 57fe2e8 commit 79362ad

27 files changed

+108
-34
lines changed

src/DesignTimeStyleHelper/App.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ T Create<T>() where T : class
110110
return new Mock<T>().Object;
111111
}
112112

113-
object Create(Type t)
113+
static object Create(Type t)
114114
{
115115
var moq = typeof(Mock<>).MakeGenericType(t);
116116
var ctor = moq.GetConstructor(new Type[] { });
117-
var m = ctor.Invoke(new object[] { }) as Mock;
118-
return m.Object;
117+
var m = ctor?.Invoke(new object[] { }) as Mock;
118+
return m?.Object;
119119
}
120120

121121
public ExportProvider DefaultExportProvider { get; set; }

src/GitHub.App/Infrastructure/ExportWrappers.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System.ComponentModel.Composition;
22
using Octokit.Internal;
3+
using System;
4+
using System.Net.Http;
35

46
namespace GitHub.Infrastructure
57
{
@@ -10,5 +12,8 @@ namespace GitHub.Infrastructure
1012
[Export(typeof(IHttpClient))]
1113
public class ExportedHttpClient : HttpClientAdapter
1214
{
15+
public ExportedHttpClient() :
16+
base(HttpMessageHandlerFactory.CreateDefault)
17+
{}
1318
}
1419
}

src/GitHub.App/Services/ImageDownloader.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public IObservable<byte[]> DownloadImageBytes(Uri imageUri)
3030
BaseAddress = new Uri(imageUri.GetLeftPart(UriPartial.Authority)),
3131
Endpoint = new Uri(imageUri.PathAndQuery, UriKind.RelativeOrAbsolute),
3232
Method = HttpMethod.Get,
33-
AllowAutoRedirect = true
3433
};
3534

3635
return HttpClient.Send(request)

src/GitHub.Exports/Helpers/NotificationAwareObject.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using System.ComponentModel;
2+
using GitHub.VisualStudio.Helpers;
23

34
namespace GitHub.Primitives
45
{
5-
public abstract class NotificationAwareObject : INotifyPropertyChanged
6+
public abstract class NotificationAwareObject : INotifyPropertyChanged, INotifyPropertySource
67
{
78
public event PropertyChangedEventHandler PropertyChanged;
89

src/GitHub.Exports/Primitives/HostAddress.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public override bool Equals(object obj)
9898
if (ReferenceEquals(this, obj))
9999
return true;
100100
var other = obj as HostAddress;
101-
return obj != null && WebUri.IsSameHost(other.WebUri) && ApiUri.IsSameHost(other.ApiUri);
101+
return other != null && WebUri.IsSameHost(other.WebUri) && ApiUri.IsSameHost(other.ApiUri);
102102
}
103103
}
104104
}

src/GitHub.Exports/Primitives/UriString.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ bool ParseScpSyntax(string scpString)
108108
Host = match.Groups["host"].Value.ToNullIfEmpty();
109109
Owner = match.Groups["owner"].Value.ToNullIfEmpty();
110110
RepositoryName = GetRepositoryName(match.Groups["repo"].Value);
111+
IsScpUri = true;
111112
return true;
112113
}
113114
return false;
@@ -123,15 +124,18 @@ bool ParseScpSyntax(string scpString)
123124

124125
public bool IsFileUri { get; private set; }
125126

127+
public bool IsScpUri { get; private set; }
128+
126129
public bool IsValidUri => url != null;
127130

128131
/// <summary>
129132
/// Attempts a best-effort to convert the remote origin to a GitHub Repository URL.
130133
/// </summary>
131-
/// <returns></returns>
134+
/// <returns>A converted uri, or the existing one if we can't convert it (which might be null)</returns>
132135
public Uri ToRepositoryUrl()
133136
{
134-
if (url != null && IsFileUri) return url;
137+
// we only want to process urls that represent network resources
138+
if (!IsScpUri && (!IsValidUri || IsFileUri)) return url;
135139

136140
var scheme = url != null && IsHypertextTransferProtocol
137141
? url.Scheme

src/GitHub.Exports/Services/EnterpriseProbeTask.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public async Task<EnterpriseProbeResult> ProbeAsync(Uri enterpriseBaseUrl)
3434
BaseAddress = enterpriseBaseUrl,
3535
Endpoint = endPoint,
3636
Timeout = TimeSpan.FromSeconds(3),
37-
AllowAutoRedirect = false,
3837
};
3938
request.Headers.Add("User-Agent", productHeader.ToString());
4039

src/GitHub.Exports/Services/GitService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ public static UriString GetOriginUri(IRepository repo)
167167
{
168168
return repo
169169
?.Network
170-
.Remotes
171-
.FirstOrDefault(x => x.Name.Equals("origin", StringComparison.Ordinal))
170+
.Remotes["origin"]
172171
?.Url;
173172
}
174173

src/GitHub.Exports/Services/WikiProbe.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public async Task<WikiProbeResult> ProbeAsync(Repository repo)
3434
BaseAddress = baseUri,
3535
Endpoint = new Uri(repoUri.AbsolutePath + "/wiki", UriKind.Relative),
3636
Timeout = TimeSpan.FromSeconds(3),
37-
AllowAutoRedirect = false,
3837
};
3938
request.Headers.Add("User-Agent", productHeader.ToString());
4039

src/GitHub.UI/GitHub.UI.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464
<Reference Include="WindowsBase" />
6565
</ItemGroup>
6666
<ItemGroup>
67+
<Compile Include="Controls\Octicons\OcticonPaths.Designer.cs">
68+
<AutoGen>True</AutoGen>
69+
<DesignTime>True</DesignTime>
70+
<DependentUpon>OcticonPaths.resx</DependentUpon>
71+
</Compile>
6772
<None Include="..\..\script\Key.snk" Condition="$(Buildtype) == 'Internal'">
6873
<Link>Key.snk</Link>
6974
</None>
@@ -85,7 +90,6 @@
8590
</Compile>
8691
<Compile Include="Controls\Octicons\OcticonImage.cs" />
8792
<Compile Include="Controls\Octicons\OcticonPath.cs" />
88-
<Compile Include="Controls\Octicons\OcticonPaths.Designer.cs" />
8993
<Compile Include="Controls\TrimmedTextBlock.cs" />
9094
<Compile Include="Helpers\AccessKeysManagerScoping.cs" />
9195
<Compile Include="Controls\Buttons\OcticonButton.cs" />
@@ -187,6 +191,8 @@
187191
<ItemGroup>
188192
<EmbeddedResource Include="Controls\Octicons\OcticonPaths.resx">
189193
<SubType>Designer</SubType>
194+
<Generator>ResXFileCodeGenerator</Generator>
195+
<LastGenOutput>OcticonPaths.Designer.cs</LastGenOutput>
190196
</EmbeddedResource>
191197
</ItemGroup>
192198
<ItemGroup>

0 commit comments

Comments
 (0)