diff --git a/src/components/github-buttons/github-buttons.js b/src/components/github-buttons/github-buttons.js index 96d40ba2b..6849b6563 100644 --- a/src/components/github-buttons/github-buttons.js +++ b/src/components/github-buttons/github-buttons.js @@ -5,17 +5,21 @@ export default function GitHubButtons({custom_edit_url}) { if (custom_edit_url == undefined) { return (
); } else { - const url = new URL(custom_edit_url); - const parts = url.pathname.split('/'); + const url = new URL(custom_edit_url.replace('/blob/', '/tree/')); - let repoFullName = parts[1] + '/' + parts[2]; + let parts = url.pathname.split('/'); + parts.shift(); + let repoFullName = parts[0] + '/' + parts[1]; + + parts.pop(); + const componentFolderPath = parts.join('/'); return (