Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Gist detection; exclude Gist profiles from isProfile #132

Merged
merged 7 commits into from
Jul 28, 2022

Conversation

fregante
Copy link
Member

@fregante fregante commented Jul 23, 2022

@netlify
Copy link

netlify bot commented Jul 23, 2022

Deploy Preview for preview-for-github-url-detection ready!

Name Link
🔨 Latest commit 54d4ea9
🔍 Latest deploy log https://app.netlify.com/sites/preview-for-github-url-detection/deploys/62dd33100c2168000ad668c0
😎 Deploy Preview https://deploy-preview-132--preview-for-github-url-detection.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@fregante fregante requested a review from yakov116 July 23, 2022 10:10
@fregante fregante mentioned this pull request Jul 23, 2022
]);

export const isGist = (url: URL | HTMLAnchorElement | Location = location): boolean => url.hostname.startsWith('gist.') || url.pathname.split('/', 2)[1] === 'gist';
export const isGist = (url: URL | HTMLAnchorElement | Location = location): boolean => typeof getCleanGistPathname(url) === 'string';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was incorrect. It would match gist.any.com while in reality GHE probably only supports /gist/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember we had a link to a github enterprise that we were able to test things out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wrong:

https://docs.github.com/en/enterprise-server@3.4/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists#about-gists

http(s)://[hostname]/gist or http(s)://gist.[hostname] if subdomains are enabled.

package.json Outdated
@@ -34,6 +34,7 @@
"test": "run-p build ava xo",
"watch": "run-p watch:typescript demo:watch # vite watch doesn’t generate the lib, so just use the demo",
"watch:typescript": "tsc --watch --noEmit",
"watch:ava": "run-p ava watch:typescript -- --watch",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AVA times out when there are certain type errors 🤷‍♂️

@fregante fregante marked this pull request as ready for review July 23, 2022 10:15
@fregante fregante merged commit b93c1f1 into main Jul 28, 2022
@fregante fregante deleted the gist-detection branch July 28, 2022 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Is isProfile supposed to include gist profiles? isSingleGist is too broad and incorrect
2 participants