Check for case when the link is only a fragment

From #3859.