mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-01-25 17:23:51 -05:00
Clean up unescaped & in feed XML
This commit is contained in:
@@ -17,10 +17,14 @@
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SccProjectName>
|
||||
</SccProjectName>
|
||||
<SccLocalPath>
|
||||
</SccLocalPath>
|
||||
<SccAuxPath>
|
||||
</SccAuxPath>
|
||||
<SccProvider>
|
||||
</SccProvider>
|
||||
<PublishUrl>\\server\d\FeedCenter\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Unc</InstallFrom>
|
||||
@@ -54,7 +58,7 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Common.Debug;
|
||||
using System.Text.RegularExpressions;
|
||||
using Common.Debug;
|
||||
using Common.Xml;
|
||||
using FeedCenter.FeedParsers;
|
||||
using System;
|
||||
@@ -172,6 +173,10 @@ namespace FeedCenter
|
||||
// Clean up common invalid XML characters
|
||||
feedText = feedText.Replace(" ", " ");
|
||||
|
||||
// Find ampersands that aren't properly escaped and replace them with escaped versions
|
||||
var r = new Regex("&(?!(?:[a-z]+|#[0-9]+|#x[0-9a-f]+);)");
|
||||
feedText = r.Replace(feedText, "&");
|
||||
|
||||
return Tuple.Create(FeedReadResult.Success, feedText);
|
||||
}
|
||||
catch (IOException ioException)
|
||||
|
||||
Reference in New Issue
Block a user