Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Commit

Permalink
Fixed bug in FriendlyIdentifierForDisplay creation in failed directed…
Browse files Browse the repository at this point in the history
… identity scenarios.
  • Loading branch information
AArnott committed Sep 3, 2008
1 parent e7c6495 commit cebea98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/DotNetOpenId.Test/RelyingParty/ServiceEndpointTests.cs
Expand Up @@ -116,7 +116,9 @@ public class ServiceEndpointTests {
public void FriendlyIdentifierForDisplay() {
Uri providerEndpoint= new Uri("http://someprovider");
Identifier localId = "someuser";
string[] serviceTypeUris = new string[0];
string[] serviceTypeUris = new string[] {
Protocol.v20.ClaimedIdentifierServiceTypeURI,
};
ServiceEndpoint se;

// strip of protocol and fragment
Expand Down
14 changes: 8 additions & 6 deletions src/DotNetOpenId/RelyingParty/ServiceEndpoint.cs
Expand Up @@ -72,12 +72,14 @@ internal class ServiceEndpoint : IXrdsProviderEndpoint {
friendlyIdentifierForDisplay = UserSuppliedIdentifier;
}
} else if (uri != null) {
string displayUri = uri.Uri.Authority + uri.Uri.PathAndQuery;
displayUri = displayUri.TrimEnd('/');
// Multi-byte unicode characters get encoded by the Uri class for transit.
// Since this is for display purposes, we want to reverse this and display a readable
// representation of these foreign characters.
friendlyIdentifierForDisplay = Uri.UnescapeDataString(displayUri);
if (uri != Protocol.ClaimedIdentifierForOPIdentifier) {
string displayUri = uri.Uri.Authority + uri.Uri.PathAndQuery;
displayUri = displayUri.TrimEnd('/');
// Multi-byte unicode characters get encoded by the Uri class for transit.
// Since this is for display purposes, we want to reverse this and display a readable
// representation of these foreign characters.
friendlyIdentifierForDisplay = Uri.UnescapeDataString(displayUri);
}
} else {
Debug.Fail("Doh! We never should have reached here.");
friendlyIdentifierForDisplay = ClaimedIdentifier;
Expand Down

0 comments on commit cebea98

Please sign in to comment.