Some files not found via GitLab API v4

Summary

Some files could not be retrieved (neither file metadata nor file contents) via GitLab API v4 in self-hosted instance of GitLab v13.4.2 (b08b36dccc3) installed on CentOS 7 x86_64 using Omnibus. It might be connected with URL encoding, however I am not sure about this.

Steps to reproduce

I have a private project with a folder kickstart/, in which I have a file named centos_7_csp_general.ks (this is an exact name I have). I want to get its content using API v4, however it does not work:

curl -s "https://$server/api/v4/projects/15/repository/files/kickstart%2fcentos_7_csp_general.ks?private_token=$token&ref=master"
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /api/v4/projects/15/repository/files/kickstart/centos_7_csp_general.ks was not found on this server.</p>
</body></html>

Notes

  • Note that I tried to encode the file path name name multiple ways (any combination of the following):
    • encoding the slash (this I did always);
    • encoding underscores;
    • encoding full stop / period.
  • I can get file metadata and contents for file readme.md in the repo root, but no files in subfolders.
  • It does not affect GitLab.com as I have had no such problems in here.
Edited by 🤖 GitLab Bot 🤖