Skip to content

Bugfix - fix broken ember-data GitHub URLS #862

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

Merged
merged 5 commits into from
May 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion app/helpers/github-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,24 @@ export function githubLink([project, version, file, line], { isEdit = false }) {
version
)}${file}#L${line}`;
}

// This 'packages' replacement can be removed if the following PR goes into a patch release of
// Ember Data 4.12: https://github.com/emberjs/data/pull/8598/files
//
// If the file has packages already in the path, make sure we don't
// add duplicate packages via the mainDir function.
// Fixes an issue with ember data URLS having an incorrect
// 'packages/packages' in the GitHub source URL
// For example, without this fixedFile line, a `file` with value
// '../packages/store/addon/-private/record-arrays/identifier-array.ts'
// would become
// 'https://github.com/emberjs/data/tree/v4.10.0/packages/packages/store/addon/-private/record-arrays/identifier-array.ts#L118'
const fixedFile = file?.replace('../packages/', '../');

return `https://github.com/${githubMap[project]}/tree/v${version}${mainDir(
project,
version
)}${file}#L${line}`;
)}${fixedFile}#L${line}`;
}

export default helper(githubLink);