feat-agency / vite-plugin-webfont-dl

⚡ Webfont Download Vite Plugin - Make your Vite site load faster
MIT License
302 stars 11 forks source link

404 when font file contains hyphen #19

Closed nstringham closed 1 year ago

nstringham commented 1 year ago

when the name on the woff2 file contains a - vite-plugin-webfont-dl will attempt to download only the part of the URL that comes before the -

take this for example

webfontDownload(
  ["https://fonts.googleapis.com/css2?family=Roboto&text=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"]
),

this CSS file contains this URL

https://fonts.gstatic.com/l/font?kit=KFOmCnqEu92Fr1Me4H57QnV-boS00sAHMTD4TBdQM2WKCbJZeB7L8VW_9D9CuglRuxIdhqutK5-aMlJIRL7yoO9k6A&skey=a0a0114a1dcab3ac&v=v30

but vite-plugin-webfont-dl gives this error

[webfont-dl] https://fonts.gstatic.com/l/font?kit=KFOmCnqEu92Fr1Me4H57QnV
 ERROR  [vite-plugin-webfont-dl] Request failed with status code 400 
0xb4lint commented 1 year ago

Hi @nstringham! Thank you for the issue and the PR!

v3.4.3