Unable to fetch commit data in file view, when folders are at least 2 levels deep

Summary

With the current version, Gitlab seems to have problems with urlencoding it XHR requests:

When I try to look at the contents of folders which are at least 2 levels deep, I get a message "An error occurred while fetching commit data.".

Firefox' dev console tells me that there is a 404 when trying

GET	https://<redacted>/management/-/refs/main/logs_tree/correspondence%2FtestA%2FtestB?format=json&offset=0

(note the %2F there). Indeed entering this URL manually gets a 404, but replacing the %2F with normal / works and returns a valid JSON.

Steps to reproduce

  1. Create repo with folders at least two levels deep.
  2. Try to view the content in Gitlab

Example Project

What is the current bug behavior?

I get an error message "An error occurred while fetching commit data.".

image

image

What is the expected correct behavior?

No error.

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.7.6p219
Gem Version:    3.1.6
Bundler Version:2.3.15
Rake Version:   13.0.6
Redis Version:  6.2.7
Sidekiq Version:6.5.7
Go Version:     unknown

GitLab information
Version:        15.6.2-ee
Revision:       08b668e8740
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     12.12
URL:            https://gitlab.indiscale.com
HTTP Clone URL: https://gitlab.indiscale.com/some-group/some-project.git
SSH Clone URL:  git@gitlab.indiscale.com:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: gitlab

GitLab Shell
Version:        14.13.0
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...      

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.13.0 ? ... OK (14.13.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK
Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes
Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

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 [360/469] Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... 39/2 ... yes 39/3 ... yes 38/4 ... yes 43/5 ... yes 45/6 ... yes 45/7 ... yes 43/8 ... yes 44/9 ... yes 44/10 ... yes 42/11 ... yes 42/12 ... yes 40/13 ... yes 41/14 ... yes 45/15 ... yes 43/16 ... yes 39/17 ... yes 45/18 ... yes 41/19 ... yes 41/20 ... yes 41/21 ... yes 41/22 ... yes 46/23 ... yes 36/24 ... yes 39/26 ... yes 45/27 ... yes 41/28 ... yes 47/29 ... yes 47/32 ... yes 48/33 ... yes 48/34 ... yes 39/35 ... yes 41/36 ... yes 36/37 ... yes 39/38 ... yes 51/40 ... yes 51/41 ... yes 52/42 ... yes 52/43 ... yes 41/44 ... yes 53/45 ... yes 54/46 ... yes 41/47 ... yes 55/49 ... yes 55/50 ... yes 53/51 ... yes 41/52 ... yes 39/53 ... yes 36/56 ... yes 58/57 ... yes 58/58 ... yes 37/59 ... yes 61/60 ... yes 61/61 ... yes 36/62 ... yes [300/469] 62/63 ... yes 35/64 ... yes 61/66 ... yes 61/67 ... yes 66/68 ... yes 121/69 ... yes 66/70 ... yes 65/71 ... yes 66/72 ... yes 66/73 ... yes 41/74 ... yes 62/75 ... yes 69/76 ... yes 43/77 ... yes 61/78 ... yes 82/79 ... yes 82/80 ... yes 82/81 ... yes 39/82 ... yes 39/83 ... yes 61/84 ... yes 42/85 ... yes 95/86 ... yes 97/93 ... yes 35/94 ... yes 64/95 ... yes 34/96 ... yes 41/97 ... yes 41/98 ... yes 41/99 ... yes 41/100 ... yes 41/101 ... yes 34/103 ... yes 41/104 ... yes 41/107 ... yes 41/108 ... yes 39/109 ... yes 120/110 ... yes 41/111 ... yes 38/112 ... yes 66/114 ... yes 64/115 ... yes 41/116 ... yes 41/117 ... yes 41/118 ... yes 61/119 ... yes 41/120 ... yes 41/121 ... yes 128/122 ... yes 128/123 ... yes 37/124 ... yes 39/125 ... yes 66/126 ... yes 58/127 ... yes 128/128 ... yes 41/129 ... yes 128/130 ... yes 41/131 ... yes 140/132 ... yes 41/134 ... yes 41/136 ... yes 41/137 ... yes 141/138 ... yes 141/139 ... yes 41/140 ... yes 41/142 ... yes 145/143 ... yes 147/144 ... yes 39/145 ... yes 46/146 ... yes 120/147 ... yes 120/148 ... yes 120/149 ... yes 41/150 ... yes 286/151 ... yes 36/152 ... yes 66/153 ... yes 41/154 ... yes 41/155 ... yes 303/156 ... yes 304/157 ... yes 301/159 ... yes 300/160 ... yes 299/161 ... yes 311/162 ... yes 311/163 ... yes 311/164 ... yes 315/165 ... yes 311/166 ... yes 141/167 ... yes 41/168 ... yes 320/169 ... yes 39/170 ... yes 323/171 ... yes 325/172 ... yes 147/173 ... yes 39/174 ... yes 147/175 ... yes 39/176 ... yes 39/177 ... yes 332/178 ... yes 334/179 ... yes 337/180 ... yes 141/181 ... yes 145/182 ... yes 61/183 ... yes 145/184 ... yes 145/185 ... yes 286/186 ... yes 41/187 ... yes 349/188 ... yes Redis version >= 6.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.6) Git user has default SSH configuration? ... yes Active users: ... 24 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

UPDATE the described issue was already fixed in !107994 (merged) Here I fixed the problem of getting notification X did not exist on X when switching between branches which have "/" in the name Screen_Recording_2023-01-25_at_00.33.48

Edited by Nataliia Radina