-
Notifications
You must be signed in to change notification settings - Fork 2
Fix editLink для продуктов не учитывает orgName из repositories.json #75
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 2 commits
503cdf5
173e88c
01cc92c
857e1cc
311171c
5e7874d
7eb46ea
6ecddc8
8f6637e
e9efca7
780c011
81275ef
c824520
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 |
---|---|---|
|
@@ -25,6 +25,7 @@ export default defineConfig({ | |
return { | ||
params: { | ||
organization: repoData?.organization, | ||
repository: repoData?.repository, | ||
} | ||
} | ||
|
||
|
@@ -156,8 +157,23 @@ export default defineConfig({ | |
|
||
const relativePath = pageData.relativePath | ||
const organization = pageData.params?.organization; | ||
const repository = pageData.params?.repository; | ||
|
||
// If we have repository info from params, use it directly | ||
if (organization && repository) { | ||
const [_, ...rest] = relativePath.split('/') | ||
const restPath = rest.join('/') | ||
|
||
if (relativePath.startsWith('api/')) { | ||
return `https://github.com/${organization}/${repository}/edit/master/docs/api/${restPath}` | ||
} | ||
|
||
if (relativePath.startsWith('products/')) { | ||
return `https://github.com/${organization}/${repository}/edit/master/docs/product/${restPath}` | ||
} | ||
} | ||
|
||
// Common calculation for repo extraction from relativePath | ||
// Fallback to old logic for paths that don't have repo info | ||
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. Delete fallback logic, just return '' 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. Ещё разок 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. Removed fallback logic as requested - now just returns empty string when organization and repository data is not available. This ensures only reliable edit links are shown. Fixed in 8f6637e. |
||
const [_, repoName, ...rest] = relativePath.split('/') | ||
const repoNamePath = repoName?.replace(/\d+-/g, '') || '' | ||
const restPath = rest.join('/') | ||
|
Uh oh!
There was an error while loading. Please reload this page.