Skip to content

Commit

Permalink
remove private distribution limitation for SEO suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
nadavo committed Jan 1, 2017
1 parent 52e3e8e commit 3ee4f90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
19 changes: 13 additions & 6 deletions Cloudinary.Test/ApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -845,12 +845,12 @@ public void TestDisallowUseRootPathIfNotImageUploadForRaw()
m_api.UrlImgUp.UseRootPath(true).PrivateCdn(true).ResourceType("raw").BuildUrl("test");
}

[Test]
[ExpectedException(ExpectedException = typeof(NotSupportedException), ExpectedMessage = "URL Suffix only supported in private CDN!")]
public void TestDisallowUrlSuffixInSharedDistribution()
{
m_api.UrlImgUp.Suffix("hello").BuildUrl("test");
}
//[Test]
//[ExpectedException(ExpectedException = typeof(NotSupportedException), ExpectedMessage = "URL Suffix only supported in private CDN!")]
//public void TestDisallowUrlSuffixInSharedDistribution()
//{
// m_api.UrlImgUp.Suffix("hello").BuildUrl("test");
//}

[Test]
[ExpectedException(ExpectedException = typeof(NotSupportedException), ExpectedMessage = "URL Suffix only supported for image/upload and raw/upload!")]
Expand Down Expand Up @@ -920,6 +920,13 @@ public void TestSupportUrlSuffixForRawUploads()
Assert.AreEqual("http://testcloud-res.cloudinary.com/files/test/hello", actual);
}

[Test]
public void TestSupportUrlSuffixForSharedCdn()
{
string actual = m_api.UrlImgUp.Suffix("hello").Signed(true).Format("jpg").BuildUrl("test");
Assert.AreEqual("http://res.cloudinary.com/testcloud/images/s--1TMilNWq--/test/hello.jpg", actual);
}

[Test]
public void TestResponsiveWidthTransform()
{
Expand Down
4 changes: 2 additions & 2 deletions Cloudinary/Url.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,8 @@ public string BuildUrl(string source)
if (String.IsNullOrEmpty(m_cloudName))
throw new ArgumentException("cloudName must be specified!");

if (!m_usePrivateCdn && !String.IsNullOrEmpty(m_suffix))
throw new NotSupportedException("URL Suffix only supported in private CDN!");
//if (!m_usePrivateCdn && !String.IsNullOrEmpty(m_suffix))
//throw new NotSupportedException("URL Suffix only supported in private CDN!");

if (source == null)
source = m_source;
Expand Down

0 comments on commit 3ee4f90

Please sign in to comment.