mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19858 : Media Library : OEmbed import issues
Work Item: 19858 --HG-- branch : 1.x
This commit is contained in:
@@ -44,8 +44,11 @@ namespace Orchard.MediaLibrary.Controllers {
|
||||
|
||||
var source = new WebClient().DownloadString(url);
|
||||
|
||||
// seek type="text/xml+oembed"
|
||||
// seek type="text/xml+oembed" or application/xml+oembed
|
||||
var oembedSignature = source.IndexOf("type=\"text/xml+oembed\"", StringComparison.OrdinalIgnoreCase);
|
||||
if (oembedSignature == -1) {
|
||||
oembedSignature = source.IndexOf("type=\"application/xml+oembed\"", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
if (oembedSignature != -1) {
|
||||
var tagStart = source.Substring(0, oembedSignature).LastIndexOf('<');
|
||||
var tagEnd = source.IndexOf('>', oembedSignature);
|
||||
@@ -54,7 +57,7 @@ namespace Orchard.MediaLibrary.Controllers {
|
||||
if (matches.Count > 0) {
|
||||
var href = matches[0].Groups[1].Value;
|
||||
try {
|
||||
var content = new WebClient().DownloadString(href);
|
||||
var content = new WebClient().DownloadString(Server.HtmlDecode(href));
|
||||
viewModel.Content = XDocument.Parse(content);
|
||||
}
|
||||
catch {
|
||||
@@ -79,6 +82,7 @@ namespace Orchard.MediaLibrary.Controllers {
|
||||
|
||||
part.FileName = url;
|
||||
part.MimeType = "text/html";
|
||||
part.FolderPath = folderPath;
|
||||
part.Title = oembed.Element("title").Value;
|
||||
if (oembed.Element("description") != null) {
|
||||
part.Caption = oembed.Element("description").Value;
|
||||
|
Reference in New Issue
Block a user