From 3ee4f90b11dda3a07774a09f4d0a888fd172a4de Mon Sep 17 00:00:00 2001 From: nadavo Date: Sun, 1 Jan 2017 14:58:55 +0000 Subject: [PATCH 1/2] remove private distribution limitation for SEO suffix --- Cloudinary.Test/ApiTest.cs | 19 +++++++++++++------ Cloudinary/Url.cs | 4 ++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Cloudinary.Test/ApiTest.cs b/Cloudinary.Test/ApiTest.cs index 77a6c196..b21d35a4 100755 --- a/Cloudinary.Test/ApiTest.cs +++ b/Cloudinary.Test/ApiTest.cs @@ -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!")] @@ -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() { diff --git a/Cloudinary/Url.cs b/Cloudinary/Url.cs index d0a9dadb..a9ed4f75 100755 --- a/Cloudinary/Url.cs +++ b/Cloudinary/Url.cs @@ -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; From feddbbb0bd429dcc660aa92cd4168cde4bab93bd Mon Sep 17 00:00:00 2001 From: Amir Tocker Date: Thu, 5 Jan 2017 16:02:31 +0200 Subject: [PATCH 2/2] Remove commented out code --- Cloudinary.Test/ApiTest.cs | 7 ------- Cloudinary/Url.cs | 3 --- 2 files changed, 10 deletions(-) diff --git a/Cloudinary.Test/ApiTest.cs b/Cloudinary.Test/ApiTest.cs index b21d35a4..769f0964 100755 --- a/Cloudinary.Test/ApiTest.cs +++ b/Cloudinary.Test/ApiTest.cs @@ -845,13 +845,6 @@ 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 for image/upload and raw/upload!")] public void TestDisallowUrlSuffixInNonUploadTypes() diff --git a/Cloudinary/Url.cs b/Cloudinary/Url.cs index a9ed4f75..9a614756 100755 --- a/Cloudinary/Url.cs +++ b/Cloudinary/Url.cs @@ -492,9 +492,6 @@ 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 (source == null) source = m_source;