Skip to content

Repository Files API breakage for `file_path` in 12.9.0 – leading slash no longer allowed

Summary

A url encoded leading slash (/%2F) previously was allowed, but seems to result in a 400 starting with gitlab 12.9.0

Steps to reproduce

https://gitlab.com/api/v4/projects/278964/repository/files/%2FLICENSE/raw?ref=master should work but it does not.

https://gitlab.com/api/v4/projects/278964/repository/files/LICENSE/raw?ref=master works because it contains no leading slash.

What is the current bug behavior?

400 with

{
    "error": "file_path should be a valid file path"
}

What is the expected correct behavior?

File should be returned

Output of checks

This bug happens on GitLab.com