From a1910c752128afbf56ebfe485cc6f7a23bb93918 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 15 Oct 2012 10:58:22 -0700 Subject: [PATCH] Fixing Remote Blog Post publishing A new blog post containing tags could not be processed --HG-- branch : 1.x extra : rebase_source : 8816df6c0a1077d702161d0a71469d1985d9a37c --- .../Modules/Orchard.Tags/Services/XmlRpcHandler.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Tags/Services/XmlRpcHandler.cs b/src/Orchard.Web/Modules/Orchard.Tags/Services/XmlRpcHandler.cs index ce09470ad..01226cad7 100644 --- a/src/Orchard.Web/Modules/Orchard.Tags/Services/XmlRpcHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Tags/Services/XmlRpcHandler.cs @@ -60,7 +60,7 @@ namespace Orchard.Tags.Services { break; case "metaWeblog.newPost": MetaWeblogUpdateTags( - Convert.ToInt32(context.Request.Params[0].Value), + GetId(context.Response), // for a new Post, the id is in the Response, as the request contains the blogId Convert.ToString(context.Request.Params[1].Value), Convert.ToString(context.Request.Params[2].Value), (XRpcStruct)context.Request.Params[3].Value, @@ -79,6 +79,12 @@ namespace Orchard.Tags.Services { } } + private static int GetId(XRpcMethodResponse response) { + return response != null && response.Params.Count == 1 && response.Params[0].Value is int + ? Convert.ToInt32(response.Params[0].Value) + : 0; + } + private void MetaWeblogAttachTagsToPost(XRpcStruct postStruct, int postId, string userName, string password, ICollection drivers) { if (postId < 1) return;