Invalid ref (`HEAD`) when querying blob info via GraphQL
Summary
Passing HEAD
as a ref
when querying for blob info via GraphQL (repository > blobs > nodes
) results in a Ref is not valid
error and as a result, the refactored blob viewer cannot be rendered.
Steps to reproduce
Via GraphQL explorer
query getBlobInfo($projectPath: ID!, $filePath: String!, $ref: String!) {
project(fullPath: $projectPath) {
repository {
blobs(paths: [$filePath], ref: $ref) {
nodes {
id
name
}
}
}
}
}
{
"filePath": "package.json",
"projectPath": "flightjs/Flight",
"ref": "HEAD"
}
Via frontend
- Open a file via the repository files browser
- Replace the branch name in the URL with
HEAD
Example Project
What is the current bug behavior?
When passing HEAD
in the ref
query variable, the GraphQL response includes a Ref is not valid
error.
What is the expected correct behavior?
When passing HEAD
as ref, the GraphQL response should include the blob info.
Relevant logs and/or screenshots
{
"data": {
"project": {
"repository": {
"blobs": null
}
}
},
"errors": [
{
"message": "Ref is not valid",
"locations": [
{
"line": 5,
"column": 7
}
],
"path": [
"project",
"repository",
"blobs"
]
}
]
}
before | after |
---|---|
![]() |
![]() |
Edited by Jacques Erasmus