google-fonts icon indicating copy to clipboard operation
google-fonts copied to clipboard

Cloudfront urls are http instead of https which break snack

Open peterpme opened this issue 3 years ago • 6 comments

I was digging into why my font wasn't showing up on Snack. I console logged the package and saw that the url was http instead of https. I grabbed the URL directly and added https and it worked

https://snack.expo.io/@peterpme/broken-inter-font-with-http https://snack.expo.io/@peterpme/working-inter-font-with-https

peterpme avatar Jun 30 '21 00:06 peterpme

Hmmm... I don't know why we would ever use an http URL. Do you see an easy place to transform it to https?

ccheever avatar Jun 30 '21 03:06 ccheever

Hey, thanks for the quick response!

When I console.log:

import { useFonts, Inter_900Black } from '@expo-google-fonts/inter';
console.log(Inter_900Black)

The URL returned is a cloudfront url. I'm not sure its specific to google's because there's snackager in the url: http://d37p21p3n8r8ug.cloudfront.net/snackager-1%2F%40expo-google-fonts~inter%400.1.0-web/assets/_inter_900black.ttf

The urls here all have https: https://github.com/expo/google-fonts/blob/master/packages/expo-google-fonts/index.js

That being said, in all the font-specific packages, I do see http: https://github.com/expo/google-fonts/search?q=http%3A%2F%2F

I imagine there's a script we can run to process those URLs when generating the individual package?

peterpme avatar Jun 30 '21 15:06 peterpme

I think this is a bug in Snack actually. If you look at the source of the package, Inter_900Black is just a local asset.

export const Inter_900Black = require('./Inter_900Black.ttf');

That should probably be turned into an https URL by Snack instead of an http one. I'll file an issue there.

On Wed, Jun 30, 2021 at 11:35 AM Peter Piekarczyk @.***> wrote:

Hey, thanks for the quick response!

When I console.log:

import { useFonts, Inter_900Black } from @.***/inter'; console.log(Inter_900Black)

The URL returned is a cloudfront url. I'm not sure its specific to google's because there's snackager in the url: http://d37p21p3n8r8ug.cloudfront.net/snackager-1%2F%40expo-google-fonts~inter%400.1.0-web/assets/_inter_900black.ttf

The urls here all have https:

https://github.com/expo/google-fonts/blob/master/packages/expo-google-fonts/index.js

That being said, in all the font-specific packages, I do see http: https://github.com/expo/google-fonts/search?q=http%3A%2F%2F

I imagine there's a script we can run to process those URLs when generating the individual package?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/expo/google-fonts/issues/33#issuecomment-871509040, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN3D2QQ7BD7ORHZVGPUELTVM2VLANCNFSM47RHLRYQ .

ccheever avatar Jun 30 '21 15:06 ccheever

Awesome, thank you!

peterpme avatar Jun 30 '21 15:06 peterpme

Actually, any chance you could file the issue since you already have a repro handy and I don't?

On Wed, Jun 30, 2021 at 11:47 AM Peter Piekarczyk @.***> wrote:

Awesome, thank you!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/expo/google-fonts/issues/33#issuecomment-871518201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAN3D7IOIJKIRAEBLHMU3LTVM4B7ANCNFSM47RHLRYQ .

ccheever avatar Jun 30 '21 15:06 ccheever

@IjzerenHein and I are going to test this PR which should fix this issue. Changing this has a big impact, so we prefer to fully test it on staging before rolling it out on production.

byCedric avatar Jul 01 '21 13:07 byCedric