isomerpages / isomercms-backend

A static website builder and host for the Singapore Government
5 stars 1 forks source link

IS-398: Write retrieve images from disk and return as base 64 #890

Closed harishv7 closed 1 year ago

harishv7 commented 1 year ago

Problem

Extend logic of converting images to base64 currently used for private repositories to cover all repositories.

Closes IS-398

Solution

MediaFileService's read delegates to the readMediaFile function located in RepoService, which calls readMedia function in GitFileSystemService for a whitelisted repository, or forwards the request to the getMediaFileInfo utility function.

MediaDirectoryService calls RepoService's readMediaDirectory and conditionally outputs the media directory contents depending on if it is a whitelisted repo or not.

Breaking Changes

Tests

CMS Flows

Note for local testing, you need to clone the repo to disk and whitelist it first