-
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.
- Loading branch information
1 parent
2a982dc
commit c1115f8
Showing
9 changed files
with
78 additions
and
559 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
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,19 @@ | ||
// 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 | ||
{ | ||
/// <summary> | ||
/// This method is used to check if the distance between the currently uploaded package ID and another package ID is less than or equal to the threshold. | ||
/// </summary> | ||
/// <param name="uploadedPackageId">Uploaded package Id</param> | ||
/// <param name="packageId">Package Id compared to</param> | ||
/// <returns>Return true if distance is less than the threshold</returns> | ||
bool IsDistanceLessThanOrEqualToThreshold(string uploadedPackageId, 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,13 @@ | ||
// 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 ExactMatchTyposquattingServiceHelper : ITyposquattingServiceHelper | ||
{ | ||
public bool IsDistanceLessThanOrEqualToThreshold(string uploadedPackageId, string packageId) | ||
{ | ||
return uploadedPackageId.ToLowerInvariant() == 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.