Images not rendering using relative paths
Summary
Relative images aren't being reproduced from the same folder. I have a documentation repository with subdirectories. In one of the subdirectories, I have a Markdown document and an img folder for images. When writing the Markdown for the page, I use a relative link to the image like so:
![Folder Permissions](img/folder_permissions.png)
On my Markdown editor (Typora) it renders as it should. However, in GitLab, it's showing a broken link. It's broken because it's pulling the relative link from the branch URL instead of the same URL that has the Markdown page.
- URL for page:
https://gitlab-ce.xxxx.org/syseng/documentation/blob/master/feedzai/dfs/windowssetup.md
- URL for image:
https://gitlab-ce.xxxx.org/syseng/documentation/master/img/folder_permissions.png
As you can see, GitLab thinks the 'img' folder is at the root of the master branch and not the correct folder.
Steps to reproduce
- Create image subfolder with images
- Create Markdown page with relative image link to subfolder.
- Render the page in GitLab
What is the current bug behavior?
Relative image links are relative to branch folder, not current folder.
What is the expected correct behavior?
Relative image links should be relative to the current folder
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Current User: git Using RVM: no Ruby Version: 2.4.4p296 Gem Version: 2.7.6 Bundler Version:1.16.2 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.17.1 Sidekiq Version:5.1.3 Go Version: unknown
GitLab information Version: 11.1.2 Revision: 35936b0 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://gitlab-ce.cucsi.org HTTP Clone URL: https://gitlab-ce.cucsi.org/some-group/some-project.git SSH Clone URL: git@gitlab-ce.cucsi.org:some-group/some-project.git Using LDAP: yes Using Omniauth: no
GitLab Shell Version: 7.1.4 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...
GitLab Shell version >= 7.1.4 ? ... OK (7.1.4) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 3/1 ... ok 3/2 ... ok 3/3 ... ok 3/4 ... ok 3/5 ... ok 3/6 ... ok 12/7 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml Checking LDAP ...
Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) HIDDEN FOR SECURITY RERASONS
Checking LDAP ... Finished
Checking GitLab ...
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 Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 3/1 ... yes 3/2 ... yes 3/3 ... yes 3/4 ... yes 3/5 ... yes 3/6 ... yes 12/7 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.4.4) Git version >= 2.9.5 ? ... yes (2.17.1) Git user has default SSH configuration? ... yes Active users: ... 10
Checking GitLab ... Finished
(we will only investigate if the tests are passing)