Support atompub service link with relative URL
This commit is contained in:
parent
7fb9626a9b
commit
ccf7f9a540
|
@ -162,7 +162,7 @@ namespace OpenLiveWriter.BlogClient.Detection
|
|||
_serviceName = atomProvider.Name;
|
||||
_clientType = atomProvider.ClientType;
|
||||
_blogName = string.Empty;
|
||||
_postApiUrl = linkUrl;
|
||||
_postApiUrl = GetAbsoluteUrl(url, linkUrl);
|
||||
|
||||
IBlogClient client = BlogClientManager.CreateClient(atomProvider.ClientType, _postApiUrl, _credentials);
|
||||
client.VerifyCredentials();
|
||||
|
@ -192,6 +192,19 @@ namespace OpenLiveWriter.BlogClient.Detection
|
|||
return false;
|
||||
}
|
||||
|
||||
private string GetAbsoluteUrl(string url, string linkUrl)
|
||||
{
|
||||
Uri absoluteUrl;
|
||||
if (Uri.TryCreate(linkUrl, UriKind.Absolute, out absoluteUrl))
|
||||
{
|
||||
return linkUrl;
|
||||
}
|
||||
|
||||
Uri baseUrl = new Uri(url);
|
||||
absoluteUrl = new Uri(baseUrl, linkUrl);
|
||||
return absoluteUrl.AbsoluteUri;
|
||||
}
|
||||
|
||||
private class BloggerGeneratorCriterion : IElementPredicate
|
||||
{
|
||||
public bool IsMatch(Element e)
|
||||
|
|
Loading…
Reference in New Issue