fixes Newtonsoft.Json.JsonSerializationException with OwnCloud upload

Currently, when a file is uploaded, and an error is generated, a JSON
serialization error is thrown because of the unexpected JSON output.
This commit fixes that.
This commit is contained in:
wforums 2015-11-28 03:18:33 +01:00
parent b0c73d87da
commit 9bdae1313d

View file

@ -24,6 +24,7 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ShareX.HelpersLib;
using System;
using System.Collections.Generic;
@ -133,7 +134,8 @@ public string ShareFile(string path)
{
if (result.ocs.data != null && result.ocs.meta.statuscode == 100)
{
string link = result.ocs.data.url;
OwnCloudShareResponseData data = ((JObject)result.ocs.data).ToObject<OwnCloudShareResponseData>();
string link = data.url;
if (DirectLink) link += (IsCompatibility81 ? "/download" : "&download");
return link;
}
@ -155,7 +157,7 @@ public class OwnCloudShareResponse
public class OwnCloudShareResponseOcs
{
public OwnCloudShareResponseMeta meta { get; set; }
public OwnCloudShareResponseData data { get; set; }
public object data { get; set; }
}
public class OwnCloudShareResponseMeta