Skip to content

Commit

Permalink
Fix: xlink:href value format.
Browse files Browse the repository at this point in the history
  • Loading branch information
H1Gdev authored and mrbean-bremen committed May 16, 2019
1 parent d2f43bf commit 9dd2d50
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Source/SvgElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml;
using System.Linq;
using Svg.Transforms;
using System.Reflection;
using System.Threading;
using System.Globalization;
using System.Text;
using System.Xml;
using Svg.Transforms;

namespace Svg
{
Expand Down Expand Up @@ -661,6 +660,12 @@ protected virtual void WriteAttributes(XmlTextWriter writer)

if (propertyValue != null)
{
if (!string.IsNullOrEmpty(value))
{
if (attr.Attribute.NamespaceAndName == "xlink:href" && value.StartsWith("url("))
value = new StringBuilder(value).Remove(value.Length - 1, 1).Remove(0, 4).ToString();
}

//Only write the attribute's value if it is not the default value, not null/empty, or we're forcing the write.
if (forceWrite || (!string.IsNullOrEmpty(value) && !SvgDefaults.IsDefault(attr.Attribute.Name, attr.Property.ComponentType.Name, value)))
{
Expand Down

0 comments on commit 9dd2d50

Please sign in to comment.