-
Notifications
You must be signed in to change notification settings - Fork 2
Fix editLink for products not accounting for orgName from repositories.json #74
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
Changes from 3 commits
5efdd92
2e05593
a6453c2
63ccb0a
816719e
718e717
f9a40a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,8 @@ export default defineConfig({ | |
const repositoriesMap: Map<string, RepoData> = new Map(repositories.map((repoData: RepoData) => [repoData.repository, repoData])); | ||
|
||
const repoName = pageData.relativePath.split('/')[1]; | ||
const repoData = repositoriesMap.get(repoName); | ||
const cleanRepoName = repoName?.replace(/\d+-/g, ''); | ||
const repoData = repositoriesMap.get(cleanRepoName); | ||
|
||
return { | ||
params: { | ||
|
@@ -155,9 +156,11 @@ export default defineConfig({ | |
pattern: ( pageData ) => { | ||
|
||
const filePath = pageData.filePath | ||
const relativePath = pageData.relativePath | ||
const organization = pageData.params?.organization; | ||
|
||
const [_, repoName, ...rest] = filePath.split('/') | ||
// Use relativePath to get the original repository name (before rewrites) | ||
const [_, repoName, ...rest] = relativePath.split('/') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. что-то не сходится. раз это до рерайтов, значит, здесь имя репозитория будет с цифрами в начале. в filePath цифр уже быть не должно, а значит и replace строкой ниже уже не нужен. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right about the logic. I'm using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Используй filePath There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed to use filePath instead of relativePath and removed the manual cleaning since filePath is already processed by URL rewrites. Commit 816719e |
||
const repoNamePath = repoName.replace(/\d+-/g, '') | ||
const restPath = rest.join('/') | ||
const orgName = organization || 'autumn-library'; | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inlined the variable as requested in commit a6453c2