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
[ ] Yes - this PR contains breaking changes
Details ...
[X] No - this PR is backwards compatible
Tests
Unit tests for MediaFileService, MediaDirectoryService, RepoService should all pass
Image from non-whitelisted, public repository should continue to be retrieved from raw.githubusercontent.com
Image from non-whitelisted, private repository should continue to be retrieved from raw.githubusercontent.com, and then converted to base64 returned to the user
Image from whitelisted repository (regardless of public or private) should be retrieved from the local file system, then converted to base64 returned to the user
CMS Flows
Go to Images section and ensure the images are loading correctly from disk
Step into nested folders and ensure images are loading fine
Right click on images -> open in new tab -> ensure image src is in base64
Note for local testing, you need to clone the repo to disk and whitelist it first
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 thereadMediaFile
function located in RepoService, which callsreadMedia
function in GitFileSystemService for a whitelisted repository, or forwards the request to thegetMediaFileInfo
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
Unit tests for MediaFileService, MediaDirectoryService, RepoService should all pass
Image from non-whitelisted, public repository should continue to be retrieved from raw.githubusercontent.com
Image from non-whitelisted, private repository should continue to be retrieved from raw.githubusercontent.com, and then converted to base64 returned to the user
Image from whitelisted repository (regardless of public or private) should be retrieved from the local file system, then converted to base64 returned to the user
CMS Flows
Note for local testing, you need to clone the repo to disk and whitelist it first