Repository files api is returning Ruby hashes instead of JSON to the get file call
Summary
All of the other api calls return JSON but the get file call returns a Ruby hash.
Steps to reproduce
As per the section "Get file from repository" in the API docs I use the following style of url.
GET /projects/:id/repository/files/:file_path
The example from the docs is curl --request GET --header 'PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK' 'https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb?ref=master'
What is the current bug behavior?
I receive something like the following:-
{ :file_name=>"key.rb", :file_path"=>"app/models/key.rb", :size=>1476, :encoding=>"base64", :content=>"IyA9PSBTY2hlbWEgSW5mb3...", :ref=>"master", :blob_id=>"79f7bbd25901e8334750839545a9bd021f0e4c83", :commit_id=>"d5a3ff139356ce33e37e73add446f16869741b50", :last_commit_id=>"570e7b2abdd848b95f2f578043fc23bd6f6fd24d" }
What is the expected correct behavior?
The docs show that the following should be returned:-
{ "file_name": "key.rb", "file_path": "app/models/key.rb", "size": 1476, "encoding": "base64", "content": "IyA9PSBTY2hlbWEgSW5mb3...", "ref": "master", "blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83", "commit_id": "d5a3ff139356ce33e37e73add446f16869741b50", "last_commit_id": "570e7b2abdd848b95f2f578043fc23bd6f6fd24d" }
Results of GitLab environment info
System information System: Ubuntu 14.04 Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 10.5.0 Redis Version: 3.2.5 Git Version: 2.11.1 Sidekiq Version:4.2.7
GitLab information Version: 9.1.2 Revision: df1403f Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: HTTP Clone URL: SSH Clone URL: Using LDAP: yes Using Omniauth: no
GitLab Shell Version: 5.0.2 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
Checking GitLab Shell ...
GitLab Shell version >= 5.0.2 ? ... OK (5.0.2) 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 4/3 ... ok 4/4 ... ok 4/5 ... ok 4/6 ... ok 4/7 ... ok 4/8 ... ok 4/9 ... ok 4/10 ... ok 4/11 ... ok 4/12 ... ok 4/13 ... ok 4/14 ... ok 4/15 ... ok 14/20 ... ok 14/21 ... ok 24/22 ... ok 4/23 ... repository is empty 4/24 ... ok 14/25 ... ok 14/26 ... ok 4/27 ... ok 14/28 ... ok 14/29 ... ok 24/30 ... ok 2/31 ... ok 14/32 ... ok 24/33 ... ok 3/35 ... repository is empty 3/36 ... repository is empty 3/37 ... ok 3/38 ... repository is empty 3/39 ... ok 3/40 ... ok 24/44 ... ok 24/45 ... ok 14/50 ... ok 24/57 ... ok 24/67 ... ok 31/69 ... ok 42/89 ... ok 24/90 ... ok 24/92 ... ok 24/93 ... ok 3/94 ... ok 3/95 ... ok 24/98 ... ok 3/99 ... ok 65/100 ... ok 24/102 ... repository is empty 59/103 ... ok 49/104 ... ok 14/105 ... ok 24/106 ... ok 14/107 ... ok 3/108 ... ok 28/111 ... ok 3/112 ... ok 39/113 ... ok 39/114 ... ok 3/115 ... ok 3/116 ... ok 3/117 ... ok 84/118 ... ok 24/119 ... ok 24/120 ... ok 3/122 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.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 ...
Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results)
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? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) projects have namespace: ... 4/2 ... yes 4/3 ... yes 4/4 ... yes 4/5 ... yes 4/6 ... yes 4/7 ... yes 4/8 ... yes 4/9 ... yes 4/10 ... yes 4/11 ... yes 4/12 ... yes 4/13 ... yes 4/14 ... yes 4/15 ... yes 14/20 ... yes 14/21 ... yes 24/22 ... yes 4/23 ... yes 4/24 ... yes 14/25 ... yes 14/26 ... yes 4/27 ... yes 14/28 ... yes 14/29 ... yes 24/30 ... yes 2/31 ... yes 14/32 ... yes 24/33 ... yes 3/35 ... yes 3/36 ... yes 3/37 ... yes 3/38 ... yes 3/39 ... yes 3/40 ... yes 24/44 ... yes 24/45 ... yes 14/50 ... yes 24/57 ... yes 24/67 ... yes 31/69 ... yes 42/89 ... yes 24/90 ... yes 24/92 ... yes 24/93 ... yes 3/94 ... yes 3/95 ... yes 24/98 ... yes 3/99 ... yes 65/100 ... yes 24/102 ... yes 59/103 ... yes 49/104 ... yes 14/105 ... yes 24/106 ... yes 14/107 ... yes 3/108 ... yes 28/111 ... yes 3/112 ... yes 39/113 ... yes 39/114 ... yes 3/115 ... yes 3/116 ... yes 3/117 ... yes 84/118 ... yes 24/119 ... yes 24/120 ... yes 3/122 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.1.0 ? ... yes (2.3.3) Your git bin path is "/opt/gitlab/embedded/bin/git" Git version >= 2.7.3 ? ... yes (2.11.1) Active users: 97
Checking GitLab ... Finished