+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Images & Documents - Custom Library: doc title href not working

Images & Documents - Custom Library: doc title href not working

4 posts, 0 answered
  1. Brad
    Brad avatar
    8 posts
    Registered:
    18 Feb 2008
    22 Mar 2010
    Link to this post
    Thanks for a great product! I am currently using 3.6 and utilizing the document library for managing mp3's. It appears that the doctitle href does not know how to handle the file extension. This is a particular problem in Internet Explorer. When you hover the link the file extension is [filename].sflb.ashx. When clicking the 'download' link it does just fine because the ashx is set to 'download true'.

    How do I resolve this issue? Let me know if you need more information.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    22 Mar 2010
    Link to this post
    Hello Brad,

    You may find these KBs useful - How to filter the default ContentHttpHandler by extension,
    How to use the real extensions for the items in the Images and Documents module

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Brad
    Brad avatar
    8 posts
    Registered:
    18 Feb 2008
    31 Mar 2010
    Link to this post
    Thanks Ivan!

    I followed the instructions from the KB article titled 'How to use the real extensions for the items in the Images and Documents module' and now the doctitle href  works as expected.

    However, the download link now is not functioning as expected. The url and file extension is correct, however it is followed with the '?download=true'. How do I either remove the '?download=true" from the url, or what would be the recommended approach from here?

    Thanks again for all your help!

    Brad
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    01 Apr 2010
    Link to this post
    Hello Brad,

    ?download=true is an internal QueryString that is used by the ContentHttpHandler to force opening Download dialog. There are several places where the QueryString is appended

    backend

    • LibraryItemEdit.ascx -  used when you edit a single item               

    <li class="downloadItem"><asp:HyperLink ID="downloadLink" onclick="javascript:needToConfirm=false;callAjaxFunc=false;" runat="server" Text="<%$Resources:ItemEdit_DownloadTheDocument %>" NavigateUrl='<%# Eval("UrlWithExtension").ToString() + "?download=true" %>'></asp:HyperLink></li>

    • LibraryItemList.ascx - used when all items are listed

    <a href='{#AbsoluteUrl#}?download=true'><%= GetLocalResourceObject("ItemList_Download") %></a>


    • LibraryItemPreview.ascx - used when you preview a single item

    <asp:HyperLink CssClass='<%# Eval("Extension").ToString().Remove(0, 1) %>' ID="downloadLink" runat="server" Text="Download File" NavigateUrl='<%# Eval("UrlWithExtension").ToString() + "?download=true" %>'></asp:HyperLink>


    frontend - DownloadList control. If you want to remove the QueryString from the url, you have to create a custom control that inherits from DownloadList and override SetItemMetaData method as shown below

    protected override void SetListMetadata(Control itemContainer, IContent contentItem)
    {
        base.SetListMetadata(itemContainer, contentItem);
        this.ShowHideWrappers(itemContainer);
     
        var downloadLink = itemContainer.FindControl("DownloadLink") as HyperLink;
        var description = itemContainer.FindControl("Description") as ITextControl;
        var extension = itemContainer.FindControl("Extension") as ITextControl;
        var size = itemContainer.FindControl("Size") as ITextControl;
        var fileDownloadLink = itemContainer.FindControl("FileDownloadLink") as HyperLink;
     
        if (description != null)
        {
            description.Text = (string)contentItem.GetMetaData("Description");
        }
        if (extension != null)
        {
            extension.Text = (string)contentItem.GetMetaData("Extension");
        }
        if (size != null)
        {
            size.Text = (string)contentItem.GetMetaData("Size");
            long lsize;
            long.TryParse(size.Text, out lsize);
            size.Text = LibraryHelper.FormatSizeString(lsize);
        }
        string ext = ContentManager.Providers[contentItem.ProviderName].ContentExtension;
        if (downloadLink != null)
        {
            if (contentItem.MimeType.StartsWith("Video", true, CultureInfo.InvariantCulture))
            {
                downloadLink.NavigateUrl = ResolveUrl(string.Format("{0}", contentItem.UrlWithExtension));
            }
            else
            {
                downloadLink.NavigateUrl = ResolveUrl(contentItem.UrlWithExtension);
            }
        }
        if (fileDownloadLink != null)
            fileDownloadLink.NavigateUrl = ResolveUrl(string.Format("{0}", contentItem.UrlWithExtension));
    }

    I checked the behavior of the IE 8 and Sitefinity 3.7 SP3 when you work with mp3 files and I am not able to reproduce the problems you have. You could take a look at the attached video. I suggest that you should download and setup a blank project of Sitefinity 3.7 SP3 and see whether you will be able to reproduce this problem at your end. If everything is working fine you could proceed with an upgrade.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 0 answered