graphql / graphql-playground

🎮 GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration)
MIT License
8.77k stars 735 forks source link

fix(graphql-playground-html): inside render-playground-page.ts removed '/' from packageName and version #1255

Closed Stradivario closed 4 years ago

Stradivario commented 4 years ago

Issue

Description

Removed incorrect dash / between packageName and version tag

Type of change

Notes

const buildCDNUrl = (packageName: string, suffix: string) => filter(`${cdnUrl}/${packageName}/${version ? `@${version}/` : ''}${suffix}` || '')

When i am using the last version patch of graphql-playground-html i get response from the browser saying

https://cdn.jsdelivr.net/npm/graphql-playground-react/@1.7.1/build/static/css/index.css

Couldn't find the requested file /@1.7.1/build/static/css/index.css in graphql-playground-react.

Also the same situation is for js bundle

https://cdn.jsdelivr.net/npm/graphql-playground-react/@1.7.1/build/static/js/middleware.js

Couldn't find the requested file /@1.7.1/build/static/js/middleware.js in graphql-playground-react.

What i have found out is that buildCDNUrl function has one slash more at the url so instead of

filter(`${cdnUrl}/${packageName}/${version ? `@${version}/` : ''}${suffix}` || '')

We should have

filter(`${cdnUrl}/${packageName}${version ? `@${version}/` : ''}${suffix}` || '')

Maybe it is hard to notice but between ${packageName} and ${version...} we have / which is not correct url

Correct URL:

https://cdn.jsdelivr.net/npm/graphql-playground-react@1.7.1/build/static/css/index.css

Incorrect URL:

https://cdn.jsdelivr.net/npm/graphql-playground-react/@1.7.1/build/static/css/index.css
CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

Stradivario commented 4 years ago

@acao

acao commented 4 years ago

duplicate of #1238