Skip to content

Make URLs in blob viewer and blob editor into clickable links

Miranda Fluharty requested to merge mfluharty-clickable-links-in-file-view into master

What does this MR do?

In the file contents displayed by the blob viewer and blob editor, make URLs into clickable links.

In both viewer and editor

  • consider anything starting with http:// or https:// and consisting of URL safe characters to be a URL
  • URL safe characters are defined as anything other than whitespace, backticks, or any of "<>{|}
  • style links as if they were no different from the rest of the line (remove theme-specific colors)
  • on hover, show an underline to indicate that they are links (and remove existing underlines from some links in editor)

In viewer only

  • when a link is clicked, navigate to it in the same window/tab

In editor only

  • when a link is clicked, open it in a new tab (target="_blank")

Screenshots

Before After
Screen_Shot_2019-10-10_at_16.57.21 viewer_after
Screen_Shot_2019-10-10_at_16.57.36 editor_after

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Issue link: #30808 (closed)

Edited by Miranda Fluharty

Merge request reports