Cannot view commit history or download file that has spaces in filename
Summary
I am using Gitlab with Nginx on an OSX server I'm experiencing the following issues when using the interface with files that contain spaces in the filename.
- Attemping to view the commit history of the file shows a blank list of commits only the git lab header.
- Attemping to download the file results in a 404.
Other files without spaces in the filename download no problem. Space are converted to %8.5 in the URL but it still fails.
Example problem URL is: eg. blob/master/Assets/Textures/Make/Dom%201.tga
Steps to reproduce
Add a file with spaces in filename to your repo. 1: Attempt to view commit history of the file. 2: Attempt to download it via the gitlab interface.
Expected behavior
1: The commit history should be listed. 2: The file should be downloaded.
Actual behaviour
1: The commit history is blank. 2: A 404 is presented.
Relevant logs and/or screenshots
Screenshots
https://www.dropbox.com/s/sbq5zdcg5dvmazj/gitlab-error1.PNG?dl=0 https://www.dropbox.com/s/bvic1sfcvxp8l0o/gitlab-error2.PNG?dl=0
Nginx Config
## GitLab
##
## Modified from nginx http version
## Modified from http://blog.phusion.nl/2012/04/21/tutorial-setting-up-gitlab-on-debian-6/
## Modified from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
##
## Lines starting with two hashes (##) are comments with information.
## Lines starting with one hash (#) are configuration parameters that can be uncommented.
##
##################################
## CONTRIBUTING ##
##################################
##
## If you change this file in a Merge Request, please also create
## a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests
##
###################################
## configuration ##
###################################
##
## See installation.md#using-https for additional HTTPS configuration details.
upstream gitlab-workhorse {
server unix:/tmp/gitlab-workhorse.socket fail_timeout=0;
}
## Redirects all HTTP traffic to the HTTPS host
server {
## Either remove "default_server" from the listen line below,
## or delete the /etc/nginx/sites-enabled/default file. This will cause gitlab
## to be served if you visit any address that your server responds to, eg.
## the ip address of the server (http://x.x.x.x/)
listen 0.0.0.0:80;
listen [::]:80 ipv6only=on default_server;
server_name git.stardotstar.com; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
return 301 https://$http_host$request_uri;
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
}
## HTTPS host
server {
listen 0.0.0.0:443 ssl;
listen [::]:443 ipv6only=on ssl default_server;
server_name git.stardotstar.com; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
## Strong SSL Security
## https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html & https://cipherli.st/
ssl on;
ssl_certificate /etc/nginx/ssl/gitlab.crt;
ssl_certificate_key /etc/nginx/ssl/gitlab.key;
# GitLab needs backwards compatible ciphers to retain compatibility with Java IDEs
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
## See app/controllers/application_controller.rb for headers set
## [Optional] If your certficate has OCSP, enable OCSP stapling to reduce the overhead and latency of running SSL.
## Replace with your ssl_trusted_certificate. For more info see:
## - https://medium.com/devops-programming/4445f4862461
## - https://www.ruby-forum.com/topic/4419319
## - https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
# ssl_stapling on;
# ssl_stapling_verify on;
# ssl_trusted_certificate /etc/nginx/ssl/stapling.trusted.crt;
# resolver 208.67.222.222 208.67.222.220 valid=300s; # Can change to your DNS resolver if desired
# resolver_timeout 5s;
## [Optional] Generate a stronger DHE parameter:
## sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
##
# ssl_dhparam /etc/ssl/certs/dhparam.pem;
## Individual nginx logs for this GitLab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
client_max_body_size 0;
gzip off;
## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://gitlab-workhorse;
}
error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
location ~ ^/(404|422|500|502|503)\.html$ {
root /home/git/gitlab/public;
internal;
}
}
Output of checks
Results of GitLab application Check
server:gitlab git$ bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
Checking GitLab Shell ...
GitLab Shell version >= 3.3.3 ? ... OK (3.3.3)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
4/2 ... ok
7/3 ... ok
7/4 ... ok
6/5 ... ok
8/6 ... ok
4/7 ... ok
11/8 ... ok
9/9 ... ok
10/11 ... ok
12/12 ... ok
6/13 ... ok
6/15 ... ok
6/17 ... ok
6/18 ... ok
6/19 ... ok
6/20 ... ok
8/21 ... ok
6/22 ... ok
10/23 ... repository is empty
4/24 ... ok
8/25 ... ok
4/26 ... ok
4/27 ... ok
4/28 ... ok
4/29 ... ok
4/30 ... ok
4/31 ... ok
4/32 ... ok
4/33 ... ok
10/34 ... ok
10/35 ... ok
10/36 ... ok
8/37 ... ok
13/38 ... ok
13/39 ... ok
13/40 ... ok
13/41 ... ok
13/42 ... ok
14/43 ... ok
10/44 ... ok
12/45 ... ok
4/46 ... ok
15/47 ... ok
15/48 ... ok
15/49 ... ok
6/50 ... ok
15/51 ... ok
6/52 ... ok
6/53 ... ok
6/54 ... ok
6/55 ... ok
6/56 ... ok
6/57 ... ok
6/58 ... ok
6/59 ... ok
16/60 ... ok
16/61 ... ok
16/62 ... ok
16/63 ... ok
16/64 ... ok
16/65 ... ok
7/66 ... ok
7/67 ... ok
7/68 ... ok
7/69 ... ok
7/70 ... ok
7/71 ... repository is empty
7/72 ... repository is empty
7/73 ... repository is empty
7/74 ... repository is empty
7/75 ... ok
6/76 ... ok
7/77 ... ok
17/79 ... ok
17/80 ... ok
6/81 ... repository is empty
7/82 ... ok
7/83 ... ok
10/84 ... ok
Running /Users/git/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /Users/git/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ...
4/2 ... yes
7/3 ... yes
7/4 ... yes
6/5 ... yes
8/6 ... yes
4/7 ... yes
11/8 ... yes
9/9 ... yes
10/11 ... yes
12/12 ... yes
6/13 ... yes
6/15 ... yes
6/17 ... yes
6/18 ... yes
6/19 ... yes
6/20 ... yes
8/21 ... yes
6/22 ... yes
10/23 ... yes
4/24 ... yes
8/25 ... yes
4/26 ... yes
4/27 ... yes
4/28 ... yes
4/29 ... yes
4/30 ... yes
4/31 ... yes
4/32 ... yes
4/33 ... yes
10/34 ... yes
10/35 ... yes
10/36 ... yes
8/37 ... yes
13/38 ... yes
13/39 ... yes
13/40 ... yes
13/41 ... yes
13/42 ... yes
14/43 ... yes
10/44 ... yes
12/45 ... yes
4/46 ... yes
15/47 ... yes
15/48 ... yes
15/49 ... yes
6/50 ... yes
15/51 ... yes
6/52 ... yes
6/53 ... yes
6/54 ... yes
6/55 ... yes
6/56 ... yes
6/57 ... yes
6/58 ... yes
6/59 ... yes
16/60 ... yes
16/61 ... yes
16/62 ... yes
16/63 ... yes
16/64 ... yes
16/65 ... yes
7/66 ... yes
7/67 ... yes
7/68 ... yes
7/69 ... yes
7/70 ... yes
7/71 ... yes
7/72 ... yes
7/73 ... yes
7/74 ... yes
7/75 ... yes
6/76 ... yes
7/77 ... yes
17/79 ... yes
17/80 ... yes
6/81 ... yes
7/82 ... yes
7/83 ... yes
10/84 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/usr/bin/git"
Git version >= 2.7.3 ? ... yes (2.9.3)
Active users: 6
Checking GitLab ... Finished
Results of GitLab environment info
server:gitlab git$ bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.3.1p112
Gem Version: 2.5.1
Bundler Version:1.12.5
Rake Version: 10.5.0
Sidekiq Version:4.1.4
GitLab information
Version: 8.11.0-rc2
Revision: 4b0d5a9
Directory: /Users/git/gitlab
DB Adapter: postgresql
URL: https://git.stardotstar.com
HTTP Clone URL: https://git.stardotstar.com/some-group/some-project.git
SSH Clone URL: git@git.stardotstar.com:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: github
GitLab Shell
Version: 3.3.3
Repository storage paths:
- default: /Volumes/Storage/GitRepos/
Hooks: /Users/git/gitlab-shell/hooks/
Git: /usr/bin/git
Possible fixes
There was a fix for this issue relating to apache configs, I am using Nginx so maybe it's a similar issue with Nginx configs? https://gitlab.com/gitlab-org/gitlab-ce/issues/3163