Commit 0d41b2dd authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix-emojis-relative-url' into 'master'

Fix emoji URLs in Markdown when relative_url_root is used

Path/URL helpers (e.g. `asset_url_helper`) already include the relative_url_root, so there is no need to attach it twice.

Also adds the ability to run rspecs with relative_url_defined on the enviornment. For example:

RELATIVE_URL_ROOT=/gitlab rspec

Closes #1728

See merge request !1254
parents 0d610270 8820785c
...@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.0.0 (unreleased) v 8.0.0 (unreleased)
- Fix URL construction for merge requests, issues, notes, and commits for relative URL config (Stan Hu) - Fix URL construction for merge requests, issues, notes, and commits for relative URL config (Stan Hu)
- Fix emoji URLs in Markdown when relative_url_root is used (Stan Hu)
- Omit filename in Content-Disposition header in raw file download to avoid RFC 6266 encoding issues (Stan HU) - Omit filename in Content-Disposition header in raw file download to avoid RFC 6266 encoding issues (Stan HU)
- Fix broken Wiki Page History (Stan Hu) - Fix broken Wiki Page History (Stan Hu)
- Prevent anchors from being hidden by header (Stan Hu) - Prevent anchors from being hidden by header (Stan Hu)
......
...@@ -77,7 +77,7 @@ module Gitlab ...@@ -77,7 +77,7 @@ module Gitlab
pipeline: options[:pipeline], pipeline: options[:pipeline],
# EmojiFilter # EmojiFilter
asset_root: Gitlab.config.gitlab.url, asset_root: Gitlab.config.gitlab.base_url,
asset_host: Gitlab::Application.config.asset_host, asset_host: Gitlab::Application.config.asset_host,
# TableOfContentsFilter # TableOfContentsFilter
......
...@@ -28,6 +28,7 @@ RSpec.configure do |config| ...@@ -28,6 +28,7 @@ RSpec.configure do |config|
config.include LoginHelpers, type: :feature config.include LoginHelpers, type: :feature
config.include LoginHelpers, type: :request config.include LoginHelpers, type: :request
config.include StubConfiguration config.include StubConfiguration
config.include RelativeUrl, type: feature
config.include TestEnv config.include TestEnv
config.infer_spec_type_from_file_location! config.infer_spec_type_from_file_location!
......
...@@ -27,6 +27,9 @@ module MarkdownMatchers ...@@ -27,6 +27,9 @@ module MarkdownMatchers
match do |actual| match do |actual|
expect(actual).to have_selector('img.emoji', count: 10) expect(actual).to have_selector('img.emoji', count: 10)
image = actual.at_css('img.emoji')
expect(image['src'].to_s).to start_with(Gitlab.config.gitlab.url + '/assets')
end end
end end
......
# Fix route helpers in tests (e.g. root_path, ...)
module RelativeUrl
extend ActiveSupport::Concern
included do
default_url_options[:script_name] = Rails.application.config.relative_url_root
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment