Skip to content

Commit 5d7c183

Browse files
authoredMay 5, 2023
Fix getRepoUrl so that it takes a parameter and returns the correct url. (ansible#3691)
* Fix getRepoUrl so that it takes a parameter and returns the correct url. * Real equality. * Fix trailing backslash. No-Issue Signed-off-by: James Tanner <tanner.jc@gmail.com>

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed
 

‎src/actions/ansible-repository-copy.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const ansibleRepositoryCopyAction = Action({
1111
`server_list = ${item.name}_repo`,
1212
'',
1313
`[galaxy_server.${item.name}_repo]`,
14-
`url=${getRepoUrl()}`,
14+
`url=${getRepoUrl(item.name)}`,
1515
'token=<put your token here>',
1616
].join('\n');
1717

‎src/containers/collection-detail/collection-distributions.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const CollectionDistributions = (props: RouteProps) => {
114114
`server_list = ${distribution.base_path}`,
115115
'',
116116
`[galaxy_server.${distribution.base_path}]`,
117-
`url=${getRepoUrl()}`,
117+
`url=${getRepoUrl(distribution.base_path)}`,
118118
'token=<put your token here>',
119119
].join('\n');
120120

‎src/containers/namespace-detail/namespace-detail.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export class NamespaceDetail extends React.Component<RouteProps, IState> {
272272
: null,
273273
].filter(Boolean);
274274

275-
const repositoryUrl = getRepoUrl();
275+
const repositoryUrl = getRepoUrl('published');
276276

277277
const noData =
278278
itemCount === 0 &&

‎src/containers/token/token-insights.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class TokenInsights extends React.Component<RouteProps, IState> {
186186
download content from Automation Hub.
187187
</Trans>
188188
</p>
189-
<ClipboardCopy isReadOnly>{getRepoUrl()}</ClipboardCopy>
189+
<ClipboardCopy isReadOnly>{getRepoUrl('published')}</ClipboardCopy>
190190
</section>
191191
<section className='body pf-c-content'>
192192
<h2>{t`SSO URL`}</h2>

‎src/utilities/get-repo-url.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// Returns the API path for a specific repository
2-
export function getRepoUrl() {
2+
export function getRepoUrl(reponame) {
33
// If the api is hosted on another URL, use API_HOST as the host part of the URL.
44
// Otherwise use the host that the UI is served from
55
const host = API_HOST ? API_HOST : window.location.origin;
66

7-
return `${host}${API_BASE_PATH}`;
7+
if (reponame === 'published') {
8+
return `${host}${API_BASE_PATH}`;
9+
}
10+
return `${host}${API_BASE_PATH}content/${reponame}/`;
811
}
912

1013
// returns the server name for (protocol-less) container urls

0 commit comments

Comments
 (0)
Please sign in to comment.