Inserting a link from SharePoint to a Word document (or other item) fails

Recently, my client reported that a user, while editing a news article, was unable to insert a link to a Word document from SharePoint. They used the ribbon like so:

They sent me a screenshot of the resulting “Select an asset” picker. The user had selected a Word document, but the document’s URL had not been populated in the Location (URL) field. Therefore, clicking OK returned a (rather obscure, user-unfriendly) error message along the lines of “Cannot redirect to an invalid URL – the protocol is missing or invalid” (loosely translated from the Danish language pack). The error essentially means, “You can’t submit an empty URL field”.

Why wasn’t the URL being populated? By sheer luck I discovered that the nature of the view in the dialog had an impact on whether the documents were selectable or not.

You need the “Type” column on the view in order for the item to be selectable. This folder, for instance, has such a column, so its contents are selectable. If there’s no “Type” column, the URL may not be populated in the “Location (URL)” field upon selecting an item.

I hope this saves you all some time of scratching your heads.