Copied to clipboard

Flag this post as spam?

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


  • Jan Brinker 77 posts 103 karma points
    Apr 11, 2013 @ 15:37
    Jan Brinker
    0

    Plugin cutting off content after mailto-links on Umbraco 6.0.3 and Razor templates

    I'm currently rebuilding my 4.11 site. I updated it to 6.0.3 and I currently want to switch from WebForm-templates to MVC-templates with razor.

    Here's a sample-template:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
    Layout = null;
    }

    header-stuff

    <div class="employeeEmail">
    <a href="mailto:@CurrentPage.email">
    @CurrentPage.email
    </a>
    </div>

    <div class="employeeText">
    @CurrentPage.bodyText
    </div>

    footer-stuff
    <a href="mailto:@CurrentPage.email">dummy</a>

    This code generates two mailto-links. If I however drop the one at the bottom, the plugin cuts off EVERYTHING after the closing a-tag of the mailto-link in the top. No budyText is being rendered, neither is the "footer-stuff". No matter if it is static or dynamic code. If I keep the mailto-link at the bottom in, it prints out everything again.

    However if there is some more content beneath that link in turn, it will get cut off again.

    The bug appears only when using Mvc Razor templates, my old WebForms template still works like a charm.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 15, 2013 @ 12:58
    Lee Kelleher
    0

    Hi Jan,

    I haven't tested this with Umbraco MVC yet. Not sure why it would be causing an issue.

    Are you able to provide an example of the email address used? (Doesn't need to be the actual email address, just the general format - looking at the top-level domain part really)

    Thanks, Lee.

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Apr 15, 2013 @ 13:06
    Dave Woestenborghs
    0

    I think this is caused because a e-mail adres contains a @ sign

    Can you try this : @Html.Raw(CurrentPage.email)

    Dave

  • Jan Brinker 77 posts 103 karma points
    Apr 15, 2013 @ 13:19
    Jan Brinker
    1

    @Dave: In the beginning, I thought so, too. But after having tried it and a lot more, it doesn't work.

    I can't put my finger down myself, as I have no clues on what points the plugin actually jumps in to do it's work, but if I for example put an email-link into the bodyText and print it out, it does never cause any error or problems.

     

    @Lee: On my test-data on my installation I used the email-addresses

    [email protected] and [email protected]

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 15, 2013 @ 13:25
    Lee Kelleher
    0

    The SafeMailLink code itself is applying a Regular Expression to the generated/rendered HTML content - so it shouldn't matter which rendering engine is used (e.g. WebForms vs MVC/Razor).  However there may be edge-cases where the RegEx isn't matching the "mailto:" link + email address correctly.

    I'll look into testing for those email addresses - specifically interested in the ".is" one, (not sure if that causes an issue).  However my current to-do list is pretty long, no idea when I'd get around to testing this.  So if anyone is interested in having a test to patch/fix ... please be my guest. (Source-code is here) - otherwise I'll eventually get around to it.

    Thanks, Lee.

  • Jan Brinker 77 posts 103 karma points
    Apr 15, 2013 @ 16:20
    Jan Brinker
    0

    I'm still not convinced that it's a tld-problem crashing the regex.

    If it was, the plugin should also crash after parsing the link in a bodyText in a way, that all following content in the bodyText is dropped. This did not happen at all. I only encountered problems when I built my own mail links like described in my initial post. No matter if I used Html.Raw or not.

    Also the mail links that I built were parsed and replaced with javascript-code which opened my Outlook with the correct email address in the recipients list. And as described the output just ended after the last of my constructed mail-links.

    However there seems to be no doubt about the plugin being the cause for the crash, as the content began rendering correctly as soon as I removed the plugin from my installation.

  • Tobias Lopez 64 posts 210 karma points
    May 24, 2016 @ 07:14
    Tobias Lopez
    0

    Hi

    I'm experiencing the same issue. But it only appears in the backend. Do you know how i could limit the plugin to the frontend?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    May 24, 2016 @ 08:50
    Lee Kelleher
    0

    Hi Tobias,

    That's strange, the code shouldn't be running in the back-office, we have a list of excluded paths here:

    https://github.com/leekelleher/umbraco-safemaillink/blob/1.3.0/Our.Umbraco.SafeMailLink/Modules/RegisterFilters.cs#L63

    I never got around to looking for a fix with the original issue here, I haven't touched the SafeMail code in over 3 years! (yikes!)

    That said, it's still totally open to contributions - if anyone is ever inclined to do so ;-)

    Cheers,
    - Lee

  • Tobias Lopez 64 posts 210 karma points
    May 24, 2016 @ 08:52
    Tobias Lopez
    0

    I'm currently debugging the project. I found the issue.

    The problem is that the dtge is requesting the preview like /1234. so it passes the reserved paths.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    May 24, 2016 @ 09:00
    Lee Kelleher
    0

    Hmmm... if I could future-proof all my packages, I'd be a rich man! :-D

    I guess as a quick & dirty fix, it would be in the IsReservedPath method to check if the "dtgePreview" querystring is present?

    DTGE code, for reference: https://github.com/leekelleher/umbraco-doc-type-grid-editor/blob/master/src/Our.Umbraco.DocTypeGridEditor/Web/Controllers/DocTypeGridEditorSurfaceController.cs#L31

  • Tobias Lopez 64 posts 210 karma points
    May 24, 2016 @ 09:01
    Tobias Lopez
    0

    PR coming ;)

Please Sign in or register to post replies

Write your reply to:

Draft