From 0978bd7e1f7d64c1635e87572fb0ffe57aba28a1 Mon Sep 17 00:00:00 2001 From: Michael Bisbjerg Date: Fri, 18 Apr 2014 21:10:00 +0200 Subject: [PATCH] Altered Find method for FreebaseIds Following up on issue #34, I've altered the Freebase searching so that it now works. At the TMDb forums, a fix was pushed which allowed working with Freebase-Id's. http://www.themoviedb.org/talk/526963d5760ee3490201c360?page=4 --- TMDbLib/Client/TMDbClientFind.cs | 7 ++++++- TMDbLibTests/ClientFindTests.cs | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/TMDbLib/Client/TMDbClientFind.cs b/TMDbLib/Client/TMDbClientFind.cs index a0bafd1..81213c2 100644 --- a/TMDbLib/Client/TMDbClientFind.cs +++ b/TMDbLib/Client/TMDbClientFind.cs @@ -20,7 +20,12 @@ namespace TMDbLib.Client public FindContainer Find(FindExternalSource source, string id) { RestRequest req = new RestRequest("find/{id}"); - req.AddUrlSegment("id", HttpUtility.UrlEncode(id)); + + if (source == FindExternalSource.FreeBaseId || source == FindExternalSource.FreeBaseMid) + // No url encoding for freebase Id's (they include /-slashes) + req.AddUrlSegment("id", id); + else + req.AddUrlSegment("id", HttpUtility.UrlEncode(id)); req.AddParameter("external_source", source.GetDescription()); diff --git a/TMDbLibTests/ClientFindTests.cs b/TMDbLibTests/ClientFindTests.cs index 6f973b8..d37fe95 100644 --- a/TMDbLibTests/ClientFindTests.cs +++ b/TMDbLibTests/ClientFindTests.cs @@ -13,8 +13,8 @@ namespace TMDbLibTests private const string tvdbBreakingBadId = "81189"; private const string imdbBreakingBadId = "tt0903747"; private const string tvRageBreakingBadId = "18164"; - private const string freebaseBreakingBadId = "/en/breaking_bad"; - private const string freebaseMidBreakingBadId = "/m/03d34x8"; + private const string freebaseBreakingBadId = "en/breaking_bad"; + private const string freebaseMidBreakingBadId = "m/03d34x8"; [TestInitialize] public void Initiator()