Skip to content

Add Snippets BlobController for raw data

Vijay Hawoldar requested to merge vij-raw-snippet-blobs into master

What does this MR do?

Adds a new Snippets BlobController for both personal and project snippets, to handle blob related actions.

This has initially been added to support returning raw data for multi-file snippets, as described in #217775 (closed)

The decision to add a BlobController rather than a RawController was made because eventually (near future) we will also be having other blob related actions for snippets, such as diff.

No changelog has been added because the newly added endpoint is currently only accessible via a feature flag

We have decided not to put this new endpoint behind a feature flag because it is ok for it to be immediately available. Using a FF would prevent unauthenticated users accessing the raw content, which would go against the existing expectation/functionality.

Testing this MR

For testing this new endpoint, you will need to establish a commit ref for personal/project snippets, and them access them at paths such as:

Project snippets:

http://yourhost:port/namespace/project-name/-/snippets/:snippet_id/raw/:ref/:filepath

e.g.

http://127.0.0.1:3000/root/snippet-testing/-/snippets/286/raw/8807792edab1f0ab1be489ddbc0f016f7f4c9cb1/myfile.txt

Personal snippets:

http://yourhost:port/-/snippets/:snippet_id/raw/:ref/:filepath

e.g.

http://127.0.0.1:3000/-/snippets/287/raw/7325f4bfc461b82306f34c58ce4604483ffa5e40/test.txt

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Refs #217775 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports