List repository recursive tree API only returning 1 page after enabling Rugged
Summary
After enabling Rugged, we noticed that GET /projects/:id/repository/tree?recursive=true returns only one page of results and does not return the full recursive tree.
Steps to reproduce
- Enable Rugged on GitLab server
- Run following Python3 script to call API and print response headers
# set GITLAB_AUTH_TOKEN env var
# update url with GitLab server and project ID
from pprint import pprint
import os
import requests
def main():
url = 'https://<gitlab_server>/api/v4/projects/<project_id>/repository/tree?recursive=true&per_page=100'
headers = {'PRIVATE-TOKEN': os.environ['GITLAB_AUTH_TOKEN']}
r = requests.get(url=url, headers=headers)
pprint(dict(r.headers))
if __name__ == "__main__":
main()
- Note that only 1 page is processed with no subdirectories
{
'X-Total': '21',
'X-Total-Pages': '1'
}
Example Project
This is happening on an internally hosted instance of GitLab, v11.8.10 with Rugged enabled.
What is the current bug behavior?
Endpoint returns only 1 page of data without full recursive tree.
What is the expected correct behavior?
Full recursive tree returned (usually multiple pages of data) with files in all subdirectories.
Relevant logs and/or screenshots
Note that Link
section contains no next
page, and X-Total-Pages
=1, even though this repo has more files.
{'Cache-Control': 'max-age=0, private, must-revalidate',
'Connection': 'keep-alive',
'Content-Length': '2633',
'Content-Type': 'application/json',
'Date': 'Fri, 17 May 2019 18:15:14 GMT',
'Etag': 'W/"<redacted>"',
'Link': '<https://<redacted>/api/v4/projects/1234/repository/tree?id=1234&page=1&per_page=100&recursive=true>; '
'rel="first", '
'<https://<redacted>/api/v4/projects/1234/repository/tree?id=1234&page=1&per_page=100&recursive=true>; '
'rel="last"',
'Server': '<redacted>',
'Strict-Transport-Security': 'max-age=31536000, max-age=31536000, '
'max-age=31536000; includeSubDomains',
'Vary': 'Origin',
'X-Cache-Status': 'MISS',
'X-Content-Type-Options': 'nosniff',
'X-Frame-Options': 'SAMEORIGIN',
'X-Next-Page': '',
'X-Page': '1',
'X-Per-Page': '100',
'X-Prev-Page': '',
'X-Request-Id': '<redacted>',
'X-Runtime': '0.111485',
'X-Total': '21',
'X-Total-Pages': '1'}