This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.
Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.
Before posting questions here you might want to review the developer documentation.
This might be fixed in newer versions of the rss & blog rss,
i had to customize the blog features a long time ago so I am not using them. So my code is not the same as the cms repo, but the same effect might happen?
We have some posts that have JS included
<script type="text/javascript">// <![CDATA[ ....
so when the trying to build the description part of the rss
xmlTextWriter.WriteCData(blogPost + signature);
or
excerpt = UIHelper.CreateExcerpt(dr["Description"].ToString(), excerptLength, ExcerptSuffix);
xmlTextWriter.WriteCData(excerpt);
I get fatal error. as inserting a cdata into a cdata is not allowed.
not sure if this is affecting the latest builds of the rss or blog rss but worth pointing out, and possibly adding a check.
on my local code i am going to just use a regex to rip out the cdata from anything going into a cdata node.
If you have code that solves the problem please post it.
Best,
Joe
i have code that does fix it... just not sure if it should be used... still looking into it
Looking into it more...
but when adding to the rss description fields, i clear all script tags ( and the content in the tags ) as well as clearing any cdata tags...
I have 2 util functions i call on the html/text before adding to the description node.
public static string RemoveScriptTags(this string text) { var options = RegexOptions.IgnoreCase | RegexOptions.Singleline; var regex = new Regex(@"<script.*?>.*?</script>", options); return regex.Replace(text, "<!-- removed script tags -->"); } public static string RemoveCDataTags(this string text) { var options = RegexOptions.IgnoreCase | RegexOptions.Singleline; var regex = new Regex(@"\<\!\[CDATA\[(?<text>[^\]]*)\]\]\>", options); return regex.Replace(text, "<!-- removed c data -->"); }
xmlTextWriter.WriteCData(excerpt.RemoveScriptTags().RemoveCDataTags());
not 100% on the regex yet... but it "Works for me" need to do some more testing to make sure its my final solution
need to look up the rss spec too to see if script tags are even allowed...