Skip to content

WikiLinkFilter fails with uncaught exception with invalid URIs

Failing text seems to be:

http://<docker machine IP address>:8080

Looks like the wrong exception is caught.

https://sentry.gitlap.com/gitlab/gitlabcom/issues/7489/

Addressable::URI::InvalidURIError: Absolute URI missing hierarchical segment: 'http://:8080'
  lib/banzai/filter/wiki_link_filter/rewriter.rb:6:in `initialize'
    @uri = Addressable::URI.parse(link_string)
  lib/banzai/filter/wiki_link_filter.rb:37:in `new'
    Rewriter.new(link_string, wiki: context[:project_wiki], slug: context[:page_slug]).apply_rules
  lib/banzai/filter/wiki_link_filter.rb:37:in `apply_rewrite_rules'
    Rewriter.new(link_string, wiki: context[:project_wiki], slug: context[:page_slug]).apply_rules
  lib/gitlab/metrics/instrumentation.rb:156:in `apply_rewrite_rules'
    retval    = super
  lib/banzai/filter/wiki_link_filter.rb:31:in `process_link_attr'
    html_attr.value = apply_rewrite_rules(html_attr.value)
...
(133 additional frame(s) were not displayed)