Incorrect URL causes issues in web editor

Summary

When using the web editor and adding an URL to a markdown file the web editor, GitLab (Vue) breaks.

Steps to reproduce

  1. Open the web editor
  2. Create/edit a markdown file
  3. Add the following URL invalid URL: [![Telegram](https://img.shields.io/badge/chat-on%telegram-brightgreen)](https://t.me/libreweb)
  4. Click the preview button in the editor

Example Project

https://gitlab.melroy.org/libreweb/browser/-/tree/25-add-windows-binary

What is the current bug behavior?

The web editor breaks.

What is the expected correct behavior?

The web editor should be robust for such URLs in the markdown.

These parsing errors should be catched.

Relevant logs and/or screenshots

URIError: malformed URI sequence
    I url_utility.js:386
    r utils.js:250
    <anonymous> utils.js:249
    showContentViewer repo_editor.vue:210
    VueJS 10
    UPDATE_FILE_EDITOR mutations.js:9
    g vuex.esm.js:844
    commit vuex.esm.js:466
    commit vuex.esm.js:465
    _withCommit vuex.esm.js:624
    commit vuex.esm.js:464
    commit vuex.esm.js:409
    commit vuex.esm.js:796
    Gi mutation_types.js:1
    g vuex.esm.js:851
    dispatch vuex.esm.js:516
    dispatch vuex.esm.js:406
    dispatch vuex.esm.js:779
    r vuex.esm.js:1064
    updateEditor repo_editor.vue:475
    click repo_editor.vue:1
    VueJS 3
vue.runtime.esm.js:1888:12

Output of checks

This bug actually happens on https://gitlab.melroy.org

Results of GitLab environment info

Expand for output related to GitLab environment info

System information
System:		Ubuntu 20.04
Current User:	git
Using RVM:	no
Ruby Version:	2.7.5p203
Gem Version:	3.1.4
Bundler Version:2.1.4
Rake Version:	13.0.6
Redis Version:	6.0.16
Git Version:	2.33.1.
Sidekiq Version:6.3.1
Go Version:	unknown

GitLab information
Version:	14.6.1
Revision:	661d663ab2b
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	12.7
URL:		https://gitlab.melroy.org
HTTP Clone URL:	https://gitlab.melroy.org/some-group/some-project.git
SSH Clone URL:	git@gitlab.melroy.org:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.22.1
Repository storage paths:
- default: 	/media/Data/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.22.1 ? ... OK (13.22.1) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ..

[...]

Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.5) Git version >= 2.33.0 ? ... yes (2.33.1) Git user has default SSH configuration? ... yes Active users: ... 447 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

Uh..

Edited by Melroy van den Berg