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.
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)
@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
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.
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.
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:
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.
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.
I think this is caused because a e-mail adres contains a @ sign
Can you try this : @Html.Raw(CurrentPage.email)
Dave
@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]
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.
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.
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?
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
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.
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?PR coming ;)
is working on a reply...