Copied to clipboard

Flag this post as spam?

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


  • Craig Nichols 3 posts 24 karma points
    Nov 23, 2010 @ 02:18
    Craig Nichols
    0

    Trouble linking to a file in Media - ~ (tilde) gets to published HTML

    Hi all

    I'm using Umbraco 4.5.2.

    I have uploaded a PDF into my media library.

    In the rich text editor for my homepage I have linked to the file through the UI link widget. After selecting the media icon and adding the link to the page if I view the HTML it is being included as <a href="/~/media/20/filename...

    When I try to view the published page it renders the tilde character to the output page exactly the same way it was linked.

    I'm aware something like this was fixed in 4.5.1 in the following changeset

    umbraco.codeplex.com/.../73401

    http://umbraco.codeplex.com/workitem/28145

    But having looked at the diff of IOHelper.cs at line 42 it says if·(virtualPath.StartsWith("~")) and I wondered if the preceding forward slash is causing a problem.

    For some reason TinyMCE insists on prefixing the URL with a forwardslash so I can't make it ~/media.

    By setting the property type to Simple Editor I was able to remove the preceding / and after saving/publishing it now works.

    It looks like the fault is TinyMCE's for messing up the URLs. I added convert_urls = false to tinyMceConfig.config's customConfig section which seems to have fixed the issue for now so that I can keep using TinyMCE.

    I thought I would share the problem and solution for any others who might be facing it.

    If there's a better way to fix it please let me know :)

    Regards

    Craig

Please Sign in or register to post replies

Write your reply to:

Draft