Skip to content

Gitlab change upload configuration uploaded avatars doesn't work

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

After uploading avatar. Avatar is not displayed.

Steps to reproduce

gitlab_rails['uploads_storage_path'] = "/data/gitlab/public/"
gitlab_rails['uploads_base_dir'] = "uploads"

then starting gitlab Change avatar with upload avatar. Then avatar is not displayed.

generated url in html page:

/uploads/user/avatar/5/avatar.png?width=400
when going to this url its redirected to
/user/avatar/uploads/5/avatar.png

what is interesting if i go to the url:

/uploads/-/system/user/avatar/5/avatar.png

its displayed correctly.

Other way to reproduce is use this docker compose yaml:

version: '3'
services:
    web:
      image: 'gitlab/gitlab-ce:13.0.6-ce.0'
      restart: always
      hostname: '192.168.56.100'
      environment:
        GITLAB_OMNIBUS_CONFIG: |
            external_url 'http://192.168.56.100:480'
            gitlab_rails['gitlab_shell_ssh_port'] = 422
            gitlab_rails['uploads_base_dir'] = "uploads"
      ports:
          - '480:480'
          - '4443:443'
          - '422:22'
      volumes:
          - config:/etc/gitlab
          - logs:/var/log/gitlab
          - data:/var/opt/gitlab
volumes:
   config:
   logs:
   data:
  1. docker-compose up
  2. goto url http://192.168.56.100:480 login as root and change avatar
  3. Generated url which is correct (if you look into volume data) http://192.168.56.100:480/uploads/user/avatar/1/avatar.png?width=40 is redirected to http://192.168.56.100:480/user/avatar/uploads/1/avatar.png and return 404
Edited by 🤖 GitLab Bot 🤖