Skip to content

Commit

Permalink
Fix applying prefix appends prefix more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffrymorris committed Dec 12, 2018
1 parent 399d46d commit a29621a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Couchbase.AspNet/CouchbaseWebProviderExtensions.cs
Expand Up @@ -6,14 +6,14 @@ namespace Couchbase.AspNet

internal static class CouchbaseWebProviderExtensions
{
//Currently not used - when project relies on MS.Logging then we can switch
public static string PrefixIdentifier(this ICouchbaseWebProvider provider, string id)
{
if (string.IsNullOrWhiteSpace(id))
{
throw new ArgumentNullException(nameof(id));
}
return provider.Prefix == null ? id : string.Concat(provider.Prefix, "-", id);

return provider.Prefix != null && !id.StartsWith(provider.Prefix) ? string.Concat(provider.Prefix, "-", id) : id;
}
}
}
Expand Up @@ -10,6 +10,7 @@ namespace Couchbase.AspNet.UnitTests
{
public class CouchbaseWebProviderExtensionsTests
{
[InlineData("xxx", "xxx-mysession", "xxx-mysession")]
[InlineData("xxx", "mysession", "xxx-mysession")]
[InlineData(null, "mysession", "mysession")]
[Theory]
Expand Down

0 comments on commit a29621a

Please sign in to comment.