Skip to content

Resolve image relative paths

Jacques Erasmus requested to merge 218531-determine-image-relative-paths into master

What does this MR do?

This MR adds a mechanism to resolve relative paths for images.

Note: This is the final MR towards delivering #218531 (closed)

Screenshots (strongly suggested)

WYSIWYG

Screenshot_2020-11-04_at_14.33.17

Test data:

In the following scenarios, I used the following data for mounts:

mounts = [
  {
    source: 'default/source/',
    target: '',
  },
  {
    source: 'source/with/target',
    target: 'target',
  },
];

Scenarios:

Given the mounts data above, assuming that we're on the master branch and that we're testing locally, URLs are generated as follows:

Markdown URL WYSIWYG URL
http://localhost/absolute/path/to/image.png http://localhost/absolute/path/to/image.png
/relative/path/to/image.png http://localhost/user1/project1/-/raw/master/default/source/relative/path/to/image.png
/target/image.png http://localhost/user1/project1/-/raw/master/source/with/target/image.png
relative/to/current/image.png http://localhost/user1/project1/-/raw/master/relative/to/current/image.png
relative/to/current/image.png http://localhost/user1/project1/-/raw/master/relative/to/current/image.png
./relative/to/current/image.png http://localhost/user1/project1/-/raw/master/./relative/to/current/image.png
../relative/to/current/image.png http://localhost/user1/project1/-/raw/master/../relative/to/current/image.png

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #218531 (closed)

Edited by Jacques Erasmus

Merge request reports

Loading