Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Calvin Frei 106 posts 314 karma points
    Nov 30, 2011 @ 09:54
    Calvin Frei
    0

    Some links aren't encoded

    Hi


    I've got a problem with the SafeMailLink.

    I've a node with a lot of emails in the content, which aren't encoded, but the email in the footer is encoded?!

    My page looks like (HTML divs):

    - navi [0 email-links]
    - wrapper, content [12 email-links]
    - header [0 email-links]
    - footer [1 email-link]

    My first thought was, that the html of the page is to big, but why can he encode the link in the footer?

    Cheers
    Calvin

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Nov 30, 2011 @ 12:23
    Lee Kelleher
    0

    Hi Calvin,

    Are the email addresses in the main content section using "mailto" links?

    Thanks, Lee.

  • Calvin Frei 106 posts 314 karma points
    Nov 30, 2011 @ 12:38
    Calvin Frei
    0

    Hi Lee

    Yes they are. This is my HTML (short version ;-)):

    <body>
          <ul id="navi">
                ...
          </ul>
          <div id="wrapper">
                <div id="content">
                      <table id="addresses">
                            <tr>
                                  ....
                            </tr>
                            <tr>
                                  <td>Firstname lastname</td>
                                  <td><a href=''mailto:test@test.ch'' title="Send mail to ...">test@test.ch</a>
                            </tr>
                            (13 more lines like the above)
                      </table>
                </div>
          </div>
          <div id="header">
                ....
          </div>
          <div id="footer">
                ..... <a href=''mailto:test@test.ch'' title="Send mail to test@test.ch">test@test.ch</a>
          </div>
    </body>

    When I delete some lines from the table, it works.

    I hope you understand my problem :-).

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Nov 30, 2011 @ 12:47
    Lee Kelleher
    0

    Ah-ha! I think I know what the problem is ... (and yes it would be a bug in the package!) ... the code that processes the HTML for the "mailto" links is done in a Response.Filter, which that content can be buffered into chunks.  Obviously my test pages haven't been large enough to hit that buffer, so I haven't seen it in chunks.

    I'll look at fixing this bug later today (can't make any promises - I've got a heavy workload).

    Thanks, Lee.

  • Calvin Frei 106 posts 314 karma points
    Nov 30, 2011 @ 12:52
    Calvin Frei
    0

    Okay cool, I'll wait for your fix :-D.

    THANKS!

    Calvin

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Dec 01, 2011 @ 01:01
    Lee Kelleher
    0

    Just released v1.0.1 of the package. This should resolve your issues. Let me know if any other issues arise.

    Cheers, Lee.

  • Calvin Frei 106 posts 314 karma points
    Dec 01, 2011 @ 08:18
    Calvin Frei
    0

    Thanks Lee for your release.

    When there are a few of emails it makes this output:

    <a href="{encodedMail}" title="Mail to xyz">asd<!--y-->.asd@<!--x-->test<!--y-->.ch</a>a href=http://www.facebook.com/pages/mypage target="_blank" title="Go to facebook page">My page</a>

    The second a-tag looks bad, it misses the "<" and bricks the whole HTML.

    Can you help me again :-)?

     

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Dec 01, 2011 @ 11:27
    Lee Kelleher
    0

    Hi Calvin,

    Would you be able to drop me an email? (via my contact form)

    Once I reply, it would be good to see a full example of the HTML source (from the rich-text editor) ... I appreciate that you can't post it on the forum (sensitive email addresses, etc).  Would be good for me to have a real-world example of the content to test against.

    Thanks, Lee.

  • Calvin Frei 106 posts 314 karma points
    Dec 02, 2011 @ 12:34
    Calvin Frei
    0

    Did you get my mail?

    Cheers
    Calvin

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Dec 04, 2011 @ 22:45
    Lee Kelleher
    0

    Hi Calvin,

    Had to take the day off work on Friday due to illness :-$  (Feeling much better now!)

    I have ran a few tests on the HTML that you sent to me ... the mailto links encoded correctly and there were no other malformed HTML tags, (I checked the Facebook links, they were fine too).

    Thinking this is related to the response buffer set by IIS, but not sure what to do about it at the moment.  Hmmm, I'll give it some more thought.

    Cheers, Lee.

  • Marc Stöcker 104 posts 550 karma points c-trib
    Dec 12, 2011 @ 14:27
    Marc Stöcker
    0

    Hi Lee, Calvin,

    just to let you know that this is no isolated occurrence: I do experience the same "broken markup" problem with v1.0.1. It's only with this release while 1.0.0 work flawlessly in that respect (while missing many links due to the chunking issue mentioned above).

    Marc

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Dec 12, 2011 @ 14:52
    Lee Kelleher
    0

    Hi Marc, Calvin,

    After some more research into the chunking issue (with Response.Filters), I believe I have a solution... aiming to schedule in a new fix release in the next couple of days (workload/dayjob permitting).

    Cheers, Lee.

  • Marc Stöcker 104 posts 550 karma points c-trib
    Dec 12, 2011 @ 15:03
    Marc Stöcker
    0

    Excellent, Lee. Thanks for the status update and all the work you put into this.

    Marc.

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Dec 13, 2011 @ 02:23
    Lee Kelleher
    0

    Hi Marc, Calvin,

    Just released v1.0.2 ... ended up being a bit more of a rewrite, but I think it performs better now (and should resolve the buffer/chunking issue).

    Let me know how it goes.

    Cheers, Lee.

  • Marc Stöcker 104 posts 550 karma points c-trib
    Dec 13, 2011 @ 09:26
    Marc Stöcker
    0

    Hi Lee,

    looking good so far! No more scrambled rendering and all the mailto-links are handled.

    Thanks! Great package!

    Marc.

  • Marc Stöcker 104 posts 550 karma points c-trib
    Dec 13, 2011 @ 13:13
    Marc Stöcker
    0

    Hi Lee,

    unfortunately there seem to be an issue with the new approach when the page uses RenderTemplate (uComponents):

    System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): Filtering is not allowed. at System.Web.HttpResponse.set_Filter(Stream value) at Our.Umbraco.SafeMailLink.Events.ApplicationEventsHandler.UmbracoDefault_BeforeRequestInit(Object sender, RequestInitEventArgs e) at umbraco.UmbracoDefault.FireBeforeRequestInit(RequestInitEventArgs e) at umbraco.UmbracoDefault.initUmbracoPage() at umbraco.UmbracoDefault.Page_PreInit(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Page.OnPreInit(EventArgs e) at System.Web.UI.Page.PerformPreInit() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.default_aspx.ProcessRequest([..]

    Any idea?

    Marc.

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Dec 13, 2011 @ 13:23
    Lee Kelleher
    0

    Thanks for the feedback Marc, much appreciated. I need a better test suite for this (at the moment, I've just got a page full of mailto links).

    I'll take a look at the code, see if I can resolve this issue.

    Cheers, Lee.

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Dec 13, 2011 @ 18:12
    Lee Kelleher
    0

    Hi Marc,

    OK, hopefully I've resolved the issue.  Released v1.1.

    Technical explanation: for v1.0.2, I'd removed the HttpModule and tried using Umbraco's exposed Page_Init event to hook in the Response.Filter ... but obviously that doesn't work with RenderTemple ... so for v1.1, I've reverted back to using a HttpModule (which should work with RenderTemplate) and still keeping the solution for the buffering/chunking issue! (phew!!!)

    Let me know if there are any further problems.

    Cheers, Lee.

  • Marc Stöcker 104 posts 550 karma points c-trib
    Dec 13, 2011 @ 18:28
    Marc Stöcker
    0

    Hi Lee,

    looks promising: All pages display correctly.

    Thanks for putting out all the fixes so rapidly!

    Marc.

     

  • Calvin Frei 106 posts 314 karma points
    Dec 14, 2011 @ 08:09
    Calvin Frei
    0

    IT WORKS ;-)! Nice, many thanks to you Lee.

    I mark your v1.1 as the solution.

    Thanks to you Lee!

    Calvin

  • Greg Berlin 818 posts 633 karma points
    Sep 27, 2012 @ 20:14
    Greg Berlin
    0

    This is not working at all on Umbraco 4.9

    Rendered code is as follows:

    <a class="content1_p2" href="mailto:info@domain.com">info@domain.com</a>

     

    Any ideas why?

  • Marc Stöcker 104 posts 550 karma points c-trib
    Oct 01, 2012 @ 08:59
    Marc Stöcker
    0

    Seems like the filter module isn't invoked at all. AFAIR the assembly attaches the IHttpModule+Filter automatically on application startup. Are you absolutely sure that the assembly is in /bin?

    I can confirm that we have the assembly running on 4.9 installs without problems and mailto links are handled as they should.

    Marc.

  • Greg Berlin 818 posts 633 karma points
    Oct 01, 2012 @ 21:58
    Greg Berlin
    0

    The binary "Our.Umbraco.SafeMailLink.dll" is in the bin folder.

  • Nora 26 posts 95 karma points
    Oct 06, 2012 @ 13:47
    Nora
    0

    Hi Lee,

    I've just tested your plugin and it's really straight forward. Thanks a lot for that. I've just experienced one issue: Links created within the umbraco rich text editor arn't converted. Links inserted into the template, textstring and textboxmultiple fields are converted correctly. The output from the richt text editor is:

    E-Mail: <a href="mailto:info@example.de" title="some title">info (at) example.de</a>

    I do not see any difference to the links converted correctly. Any ideas what could be the issue here?

    Thanks a lot.

    Nora

  • Marc Stöcker 104 posts 550 karma points c-trib
    Oct 06, 2012 @ 14:33
    Marc Stöcker
    0

    This is really strange, Nora. Alerted by your post, I checked several sites to see if we have the same issue (which obviously wouldn't have been good news at all). But every mail link is converted as expected. I explicitly checked for RTE inserted links. Can confirm all is working with several 4.9, 4.8.1 and 4.7.2 sites. The module is working on filter level with the complete (final) page output, if I recall correctly and thus doesn't care how content is rendered (usercontrol, template, xslt, razor, ...).

    Could it be that you do some kind of "double encoding" while outputting the RTE contents? If the browsers would handle this gracefully and render the content it could be nonetheless the case that the regexp that is at the heart of the Safe Mail Link module isn't picking these encoded mail links up?! Just a vague idea ...

    Marc

  • Nora 26 posts 95 karma points
    Oct 06, 2012 @ 15:02
    Nora
    0

    Hi Marc,

    thanks for your quick response and your help. I've been dealing around with this issue for some time and now noticed that there is one mail adress coming from a rte-field, which does convert correctly. So my conclusion that it must be related to the rich text editor was not correct. I've now copied the content from the rte where it worked to the other page - and the issue seems to be resolved.

    html-input rte - not working:

    Tel. +49 
    /> Fax +49
    /> E-Mail: href="mailto:info@example.de"title="E-Mail senden">info (at) example.de

    html-input rte - working correctly:

    Tel. +49 
    /> Fax +49
    />href="mailto:info@example.de"title="E-Mail senden">info (at) example.de

    On another page with this issue I deleted the "E-Mail:" before the a-element and it worked. If I insert it again, the link is not converted ?!?

    Is there any known issue about content before or after the a-element?

    Thanks a lot.

    Nora

  • Marc Stöcker 104 posts 550 karma points c-trib
    Oct 08, 2012 @ 09:27
    Marc Stöcker
    1

    Hey Nora,

    I don't know about any known issues; IMHO Lee would have solved it then. Nevertheless as the page's output markup is handled by some regex, it could miss in some circumstances, sure.

    But because your posted markup looks invalid (maybe because of the forum editor) or at least invomplete, I can't comment on the examples. Probably you could post the two snippets somewhere and insert a link here?

    If you want to take a look at the regex or want to play around with it and your markup to find out more, here's the link to the source file containing the relevant expression: https://bitbucket.org/vertino/safemaillink-for-umbraco/src/3e798f2f41d0/Our.Umbraco.SafeMailLink/Utilities/Parser.cs

    Marc.

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Oct 08, 2012 @ 10:52
    Lee Kelleher
    0

    @Marc: Thanks for picking up on this thread - very much appreciated!

    @Nora: I'll try to reproduce your issue later today (hopefully) ... if there is an issue, Marc is correct with it would be with the RegEx match - so would try to put out a fix for it.  I'll keep you posted.

    Thanks, Lee.

  • Nora 26 posts 95 karma points
    Oct 08, 2012 @ 11:09
    Nora
    0

    Hi Marc, Hi Lee,

    thank you very much for your help and the quick responses. I'm sorry - it seems that the posted markup got mixed up a little bit. Another try:

    working correctly:

    <p>Some text<br/><a href="mailto:info@example.de">info (at) example.de</a></p>

    not working:

    <p>Some text<br/>E-Mail: <a href="mailto:info@example.de">info (at) example.de</a></p>

    @ Marc: I guess you do use E-Mail-Links with text before them in the same paragraph coming from a rich-text-editor-field without problems?!? Could the problem occurring in this case be related to the umbraco version? The site is running on umbraco v 4.7.2 (Assembly version: 1.0.4500.21031).

    Thanks a lot, Nora.

  • Marc Stöcker 104 posts 550 karma points c-trib
    Oct 08, 2012 @ 17:04
    Marc Stöcker
    0

    Hey Nora,

    I tested your exact case ("E-Mail:" before a-Tag) on a 4.9 and on 4.7.1.1 site. Works as expected:

    Foo Bar Example<br /> Fon +49 (0)711 XXXXX<br /> E-Mail: <a href="javascript:if(typeof(sendEmail)=='function'){sendEmail('6D61690000000000002696368407374757474676172742D61697200000F72742E636F6D');}">foo@<!--x-->example-some-domain<!--y-->.com</a></p></div><script>

    Sorry, no 4.7.2 (w/ Safe Mail Link) instance available, where I'm allowed change content for a quick test ...

    I honestly have no idea how the umbraco version could make the difference - only because of the RTE/TinyMCE part probably; but not between 4.7.1.1 and 4.7.2 I'd say. This is really some strange bug ...

    Marc. 

     

     

     

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Oct 08, 2012 @ 17:23
    Lee Kelleher
    0

    @Nora: What's the URL of the page that this happens on?  I might have found a bug with the package, (when it checks the URL to make sure it's not a path reserved by Umbraco core).

    Thanks, Lee.

  • Nora 26 posts 95 karma points
    Oct 10, 2012 @ 11:53
    Nora
    0

    @Lee: Thanks a lot for the immediate help. I've sent you the URL via your contact form. (http://leekelleher.com/contact/) Would be great if you already discovered the problem.

    @Marc: Thank you for testing and your help.

    Have a nice day :)

    Nora

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Oct 10, 2012 @ 13:43
    Lee Kelleher
    0

    Following up on Nora's email to me (which contained links to a private website), I was able to find the bug.  For whatever reason the HTML from the rich-text editor seemed to wrap after a number of characters (about 75 chars).  This meant that some HTML tags had line-breaks in them.

    e.g.

    <a href="mailto:name@domail.com"
    title="Email">name (at) domain.com</a>

    The RegEx used for SafeMailLink doesn't take line-breaks into account, so didn't match the mailto link.  It should be a simple fix/patch.  I'll let you know once it's ready.

    Cheers, Lee.

  • Lee Kelleher 3884 posts 14615 karma points MVP 9x admin c-trib
    Oct 10, 2012 @ 13:53
    Lee Kelleher
    1

    Turned out to a super quick fix.  SafeMailLink_1.3.0.zip is ready for download!

  • Nora 26 posts 95 karma points
    Oct 10, 2012 @ 13:55
    Nora
    0

    Hi Lee,

    wow – great news! Thank you very much for the investigation and the quick support :)

    Have a nice day and thanks again, Nora

  • Marc Stöcker 104 posts 550 karma points c-trib
    Oct 12, 2012 @ 12:53
    Marc Stöcker
    0

    That explains why it wasn't easy to reproduce. Good find, Nora. And Lee, as usual, thanks for getting it fixed! :)

    Marc.

Please Sign in or register to post replies

Write your reply to:

Draft