Skip to content

Commit

Permalink
Fixed an issue with the name being incorrectly decoded by uriencodeco…
Browse files Browse the repository at this point in the history
…mponent
  • Loading branch information
niemyjski committed Jan 22, 2016
1 parent 774147c commit b8f59ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Source/Api/Controllers/OrganizationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,9 @@ private async Task<bool> IsOrganizationNameAvailableInternalAsync(string name) {
if (String.IsNullOrWhiteSpace(name))
return false;

string decodedName = Uri.UnescapeDataString(name).Trim().ToLower();
var results = await _repository.GetByIdsAsync(GetAssociatedOrganizationIds(), true);
return !results.Documents.Any(o => String.Equals(o.Name.Trim().ToLower(), name.Trim().ToLower(), StringComparison.OrdinalIgnoreCase));
return !results.Documents.Any(o => String.Equals(o.Name.Trim().ToLower(), decodedName, StringComparison.OrdinalIgnoreCase));
}

protected override async Task<PermissionResult> CanAddAsync(Organization value) {
Expand Down
5 changes: 3 additions & 2 deletions Source/Api/Controllers/ProjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,10 @@ private async Task<bool> IsProjectNameAvailableInternalAsync(string organization
return false;

var organizationIds = IsInOrganization(organizationId) ? new List<string> { organizationId } : GetAssociatedOrganizationIds();

var results = await _repository.GetByOrganizationIdsAsync(organizationIds);
return !results.Documents.Any(p => String.Equals(p.Name.Trim().ToLower(), name.Trim().ToLower(), StringComparison.OrdinalIgnoreCase));

string decodedName = Uri.UnescapeDataString(name).Trim().ToLower();
return !results.Documents.Any(p => String.Equals(p.Name.Trim().ToLower(), decodedName, StringComparison.OrdinalIgnoreCase));
}

/// <summary>
Expand Down

0 comments on commit b8f59ba

Please sign in to comment.