When linking to a document with RCE Enhancements enabled, if you select that you want to add a link and then choose the file option from the dropdown the link generated is unable to display a preview for the file and instead errors out.
Documents linked through the insert link functionality should generate previews.
Steps to Reproduce
Enable RCE Enhancements.
Upload a file to a course and create a page
From the edit view of the page select Insert -> Links -> Course Links.
Change the dropdown to files.
Link to the file
Either enable the auto-preview option for the file or attempt to preview it by clicking the preview icon.