Fix: allow Roboto fonts to load and apply correctly from GoogleFonts static site#131
Open
AndrewStopchenko-SO wants to merge 1 commit intovignaesh01:masterfrom
Open
Fix: allow Roboto fonts to load and apply correctly from GoogleFonts static site#131AndrewStopchenko-SO wants to merge 1 commit intovignaesh01:masterfrom
AndrewStopchenko-SO wants to merge 1 commit intovignaesh01:masterfrom
Conversation
Update CSP directives to include font-src which allows access to the `https://fonts.gstatic.com` - this is where the Roboto Google font gets downloaded from.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Extension's main window was not able to load the Roboto fonts because they are supplied from the

https://fonts.gstatic.comsite, which wasn't satisfying the Content Security Policy'sdefault-src;directive.A bunch of errors similar to the one below were thrown to the VSCode's Developer Tools console:
Refused to load the font 'https://fonts.gstatic.com/s/roboto/v47/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBGEe.woff2' because it violates the following Content Security Policy directive: "default-src ". Note that 'font-src' was not explicitly set, so 'default-src' is used as a fallback.As a result, extension was falling back to the Arial font:
Fix
Add the
font-src 'self' https://fonts.gstatic.comCSP directive.After the change, Roboto font is downloaded and applied correctly, and no font-related errors appear on the VSCode Dev Tools console:
