-
Notifications
You must be signed in to change notification settings - Fork 643
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new interface ITyposquattingServiceHelper
- Loading branch information
1 parent
7736941
commit a2b703f
Showing
11 changed files
with
143 additions
and
561 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/NuGetGallery.Core/Services/ITyposquattingServiceHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace NuGetGallery | ||
{ | ||
/// <summary> | ||
/// This interface for providing additional methods for ITyposquattingService. | ||
/// </summary> | ||
public interface ITyposquattingServiceHelper | ||
{ | ||
string NormalizeString(string packageId); | ||
bool IsDistanceLessThanOrEqualToThreshold(string normalizedUploadedPackageId, string normalizedPackageId, int threshold); | ||
int GetThreshold(string packageId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace NuGetGallery.Services | ||
{ | ||
public class NullTyposquattingServiceHelper : ITyposquattingServiceHelper | ||
{ | ||
public int GetThreshold(string packageId) | ||
{ | ||
return 0; | ||
} | ||
|
||
public bool IsDistanceLessThanOrEqualToThreshold(string normalizedUploadedPackageId, string normalizedPackageId, int threshold) | ||
{ | ||
return normalizedUploadedPackageId == normalizedPackageId; | ||
} | ||
|
||
public string NormalizeString(string packageId) | ||
{ | ||
return packageId.ToLowerInvariant(); | ||
} | ||
} | ||
} |
213 changes: 0 additions & 213 deletions
213
src/NuGetGallery/Services/TyposquattingDistanceCalculation.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.