Gitlab API - content_sha256 incorrect / unclear which content is calculated

Hi all,

i’m having a very strange issue that when i’m retrieving a file from Gitlab via the Repository API, the “content_sha256” is not reflecting the base64 encoded content.

Here’s an example of a base64 encoded message including the returned sha264. When using the content to caluclate the sha myself, i’m getting 505ebcb2b196f487760378e2db31aec9ade3b2017ec5fcd1a49574f8ba52ffb4 as result, which also aligns with the calculated sha of my application, however either i’m miunderstanding what the content_sha256 is actually calculating or there is a bug.

Does anyone have some insight for me? (I’m hoping the following will be formatted as code)

"entity": {
      "file_name": "transformExample_target.json",
      "file_path": "pipelines/transformExample_target.json",
      "size": 1876,
      "encoding": "base64",
      "content_sha256": "9ca326808fbad64c3fbfc28ea066c7b9b5e37e1a105dde50915af09121b39f8d",
      "ref": "KTC-Dev",
      "blob_id": "1899afc220c48f401bb3b019f084b22d8b3971cc",
      "commit_id": "3990eff1b2046237faa4f69403b64b34591f39a9",
      "last_commit_id": "313ec7025b84fc289657a82aeac5fbf62cc3e76d",
      "content": "eyJ0YXJnZXRfcnVudGltZSI6InN0YW5kYXJkIiwicHJvcGVydHlfbWFwIjp7ImluZm8iOnsicHVycG9zZSI6eyJ2YWx1ZSI6bnVsbH0sInBpcGVsaW5lX2RvY191cmkiOnsidmFsdWUiOm51bGx9LCJhdXRob3IiOnsidmFsdWUiOiJ0aG9tYXMuc2NoZWliZWxob2ZlckBsaXZlLmF0In0sIm5vdGVzIjp7InZhbHVlIjpudWxsfSwibGFiZWwiOnt9fSwiaW5wdXQiOnsiMTExMTExMTEtMTExMS0xMTExLTExMTEtMDAwMDAwMDAwMDAwX2lucHV0MCI6eyJ2aWV3X3R5cGUiOnsidmFsdWUiOiJkb2N1bWVudCJ9LCJsYWJlbCI6eyJ2YWx1ZSI6Ik1hcHBlciAtIGlucHV0MCJ9fX0sInNldHRpbmdzIjp7InBhcmFtX3RhYmxlIjp7InZhbHVlIjpbXX0sImVycm9yX3BhcmFtX3RhYmxlIjp7InZhbHVlIjpbXX0sImVycm9yX3BpcGVs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