fix: [AH-306c]: fix anonymous flow (#2574)

* Merge branch 'main' of https://git0.harness.io/l7B_kbSEQD2wjrM7PShm5w/PROD/Harness_Commons/gitness into AH-307-plus-url-support-2
* [AH-307]: Comments
* Merge commit
* Merge commit
* Merge commit
* Added comments
* Revert changes
* Merge commit
* Merge branch 'main' of https://git0.harness.io/l7B_kbSEQD2wjrM7PShm5w/PROD/Harness_Commons/gitness into AH-307-plus-url-support-2
* Merge branch 'AH-306d' of https://git0.harness.io/l7B_kbSEQD2wjrM7PShm5w/PROD/Harness_Commons/gitness into AH-307-plus-url-support-2
* fix space path handling
* Merge branch 'main' of https://git0.harness.io/l7B_kbSEQD2wjrM7PShm5w/PROD/Harness_Commons/gitness into AH-307-plus-url-support-2
* Updated URLs to support slashes with + separator
* fix: [AH-306c]: fix anonymous flow
* fix: [AH-306c]: fix anonymous flow
* feat: [AH-307]: plus url support on UI

(cherry picked from commit 3fb6add3ce03498b6668b5f8f6d547e1acedaec4)
* [AH-307]: Added examples

(cherry picked from commit e83e41303da536f421be333be04aed09fbf75f5f)
* [AH-307]: Added Regex request rewrite support

(cherry picked from commit ed7b155256bdcd1134bc228b5705556a1233add6)
* fix: [AH-306c]: fix anonymous flow
CODE-2402
Arvind Choudhary 2024-09-04 20:48:57 +00:00 committed by Harness
parent fb99bcb8d2
commit 744b884c1f
21 changed files with 199 additions and 62 deletions

View File

@ -16,6 +16,7 @@ package encode
import (
"net/http"
"regexp"
"strings"
"github.com/harness/gitness/app/api/render"
@ -32,39 +33,66 @@ const (
// GitPathBefore wraps an http.HandlerFunc in a layer that encodes a path coming
// as part of the GIT api (e.g. "space1/repo.git") before executing the provided http.HandlerFunc.
func GitPathBefore(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
_, err := pathTerminatedWithMarker(r, "", ".git", "")
if err != nil {
render.TranslatedUserError(ctx, w, err)
return
}
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
_, err := pathTerminatedWithMarker(r, "", ".git", "")
if err != nil {
render.TranslatedUserError(ctx, w, err)
return
}
next.ServeHTTP(w, r)
})
next.ServeHTTP(w, r)
},
)
}
// TerminatedPathBefore wraps an http.HandlerFunc in a layer that encodes a terminated path (e.g. "/space1/space2/+")
// before executing the provided http.HandlerFunc. The first prefix that matches the URL.Path will
// be used during encoding (prefix is ignored during encoding).
func TerminatedPathBefore(prefixes []string, next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
for _, p := range prefixes {
changed, err := pathTerminatedWithMarker(r, p, "/+", "")
if err != nil {
render.TranslatedUserError(ctx, w, err)
return
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
for _, p := range prefixes {
changed, err := pathTerminatedWithMarker(r, p, "/+", "")
if err != nil {
render.TranslatedUserError(ctx, w, err)
return
}
// first prefix that leads to success we can stop
if changed {
break
}
}
// first prefix that leads to success we can stop
if changed {
break
}
}
next.ServeHTTP(w, r)
},
)
}
next.ServeHTTP(w, r)
})
// TerminatedRegexPathBefore is similar to TerminatedPathBefore but supports regex prefixes.
func TerminatedRegexPathBefore(regexPrefixes []string, next http.Handler) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
for _, p := range regexPrefixes {
changed, err := regexPathTerminatedWithMarker(r, p, "/+", "")
if err != nil {
render.TranslatedUserError(ctx, w, err)
return
}
// first prefix that leads to success we can stop
if changed {
break
}
}
next.ServeHTTP(w, r)
},
)
}
// pathTerminatedWithMarker function encodes a path followed by a custom marker and returns a request with an
@ -86,6 +114,12 @@ func pathTerminatedWithMarker(r *http.Request, prefix string, marker string, mar
urlPath = r.URL.RawPath
}
return pathTerminatedWithMarkerAndURL(r, prefix, marker, markerReplacement, urlPath)
}
func pathTerminatedWithMarkerAndURL(
r *http.Request, prefix string, marker string, markerReplacement string, urlPath string,
) (bool, error) {
// In case path doesn't start with prefix - nothing to encode
if len(urlPath) < len(prefix) || urlPath[0:len(prefix)] != prefix {
return false, nil
@ -109,7 +143,8 @@ func pathTerminatedWithMarker(r *http.Request, prefix string, marker string, mar
prefix,
marker,
prefixWithPath,
prefixWithEscapedPath)
prefixWithEscapedPath,
)
err := request.ReplacePrefix(r, prefixWithPath, prefixWithEscapedPath)
if err != nil {
@ -119,6 +154,41 @@ func pathTerminatedWithMarker(r *http.Request, prefix string, marker string, mar
return true, nil
}
// regexPathTerminatedWithMarker is similar to pathTerminatedWithMarker but with regex prefix support.
//
// Example:
// 1. Path: "/registry/app1%2Fremote2/artifact/foo/bar/+/summary"
// Prefix: => "^/registry/([^/]+)/artifact/" Marker: => "/+" MarkerReplacement: => ""
// ==> "/registry/app1%2Fremote2/artifact/foo%2Fbar/summary"
//
// 2. Path: "/registry/abc/artifact/foo/bar/+/summary"
// Prefix: => "^/registry/([^/]+)/artifact/" Marker: => "/+" MarkerReplacement: => ""
// ==> "/registry/abc/artifact/foo%2Fbar/summary"
func regexPathTerminatedWithMarker(
r *http.Request,
regexPrefix string,
marker string,
markerReplacement string,
) (bool, error) {
prefixPattern := regexp.MustCompile(regexPrefix)
matches := prefixPattern.FindStringSubmatch(r.URL.Path)
// In case path doesn't start with prefix - nothing to encode
if len(matches) == 0 {
return false, nil
}
// We only care about the first match as we provide prefix
prefix := matches[0]
urlPath := r.URL.Path
if r.URL.RawPath != "" {
urlPath = r.URL.RawPath
}
return pathTerminatedWithMarkerAndURL(r, prefix, marker, markerReplacement, urlPath)
}
// cutOutTerminatedPath cuts out the resource path terminated with the provided marker (path segment suffix).
// e.g. subPath: "/space1/space2/+/authToken", marker: "/+" => "/space1/space2"
// e.g. subPath: "/space1/space2.git", marker: ".git" => "/space1/space2"

View File

@ -18,6 +18,7 @@ import (
"net/http"
middlewareauthn "github.com/harness/gitness/app/api/middleware/authn"
"github.com/harness/gitness/app/api/middleware/encode"
"github.com/harness/gitness/app/auth/authn"
"github.com/harness/gitness/app/auth/authz"
corestore "github.com/harness/gitness/app/store"
@ -33,6 +34,18 @@ import (
"github.com/go-chi/chi/v5"
)
var (
// terminatedPathPrefixesAPI is the list of prefixes that will require resolving terminated paths.
terminatedPathPrefixesAPI = []string{
"/api/v1/spaces/", "/api/v1/registry/",
}
// terminatedPathRegexPrefixesAPI is the list of regex prefixes that will require resolving terminated paths.
terminatedPathRegexPrefixesAPI = []string{
"^/api/v1/registry/([^/]+)/artifact/",
}
)
type APIHandler interface {
http.Handler
}
@ -72,5 +85,9 @@ func NewAPIHandler(
auditService,
)
handler := artifact.NewStrictHandler(apiController, []artifact.StrictMiddlewareFunc{})
return artifact.HandlerFromMuxWithBaseURL(handler, r, baseURL)
muxHandler := artifact.HandlerFromMuxWithBaseURL(handler, r, baseURL)
return encode.TerminatedPathBefore(
terminatedPathPrefixesAPI,
encode.TerminatedRegexPathBefore(terminatedPathRegexPrefixesAPI, muxHandler),
)
}

View File

@ -17,6 +17,8 @@ package router
import (
"net/http"
"strings"
"github.com/harness/gitness/registry/utils"
)
const RegistryMount = "/api/v1/registry"
@ -35,11 +37,13 @@ func (r *RegistryRouter) Handle(w http.ResponseWriter, req *http.Request) {
}
func (r *RegistryRouter) IsEligibleTraffic(req *http.Request) bool {
if strings.HasPrefix(req.URL.Path, RegistryMount) || strings.HasPrefix(req.URL.Path, "/v2/") ||
strings.HasPrefix(req.URL.Path, "/registry/") ||
(strings.HasPrefix(req.URL.Path, APIMount+"/v1/spaces/") &&
(strings.HasSuffix(req.URL.Path, "/artifacts") ||
strings.HasSuffix(req.URL.Path, "/registries"))) {
urlPath := req.URL.Path
if req.URL.RawPath != "" {
urlPath = req.URL.RawPath
}
if utils.HasAnyPrefix(urlPath, []string{RegistryMount, "/v2/", "/registry/"}) ||
(strings.HasPrefix(urlPath, APIMount+"/v1/spaces/") &&
utils.HasAnySuffix(urlPath, []string{"/artifacts", "/registries"})) {
return true
}

35
registry/utils/utils.go Normal file
View File

@ -0,0 +1,35 @@
// Copyright 2023 Harness, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package utils
import "strings"
func HasAnyPrefix(s string, prefixes []string) bool {
for _, prefix := range prefixes {
if strings.HasPrefix(s, prefix) {
return true
}
}
return false
}
func HasAnySuffix(s string, prefixes []string) bool {
for _, prefix := range prefixes {
if strings.HasSuffix(s, prefix) {
return true
}
}
return false
}

View File

@ -15,10 +15,18 @@
*/
import { isUndefined } from 'lodash-es'
import { encodePathParams } from '@ar/routes/utils'
import { useAppStore } from './useAppStore'
import { useDecodedParams } from './useDecodedParams'
export const encodeRef = (pattern: string): string => {
return pattern + '/+'
}
export const decodeRef = (pattern: string): string => {
if (pattern.endsWith('/+')) return pattern.replace('/+', '')
return pattern
}
export const useGetSpaceRef = (repoKey?: string): string => {
const { scope } = useAppStore()
const { space } = scope
@ -29,5 +37,6 @@ export const useGetSpaceRef = (repoKey?: string): string => {
} else if (repositoryIdentifier) {
url += `/${repositoryIdentifier}`
}
return encodePathParams(url.replace(/^\/|\/$/g, ''))
url = url.replace(/^\/|\/$/g, '')
return encodeRef(url)
}

View File

@ -22,7 +22,7 @@ import { Button, ButtonVariation, Layout, getErrorInfoFromErrorObject, useToaste
import { useUpdateArtifactLabelsMutation, type ArtifactSummary } from '@harnessio/react-har-service-client'
import { useGetSpaceRef } from '@ar/hooks'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import { useStrings } from '@ar/frameworks/strings/String'
import type { RepositoryPackageType } from '@ar/common/types'
import type { ArtifactDetailsPathParams } from '@ar/routes/types'
@ -59,7 +59,7 @@ function ArtifactDetailsHeaderContent(props: ArtifactDetailsHeaderContentProps):
const response = await modifyArtifactLabels({
body: { labels: newLabels },
registry_ref: spaceRef,
artifact: encodePathParams(artifactIdentifier)
artifact: encodeRef(artifactIdentifier)
})
if (response.content.status === 'SUCCESS') {
clear()

View File

@ -19,7 +19,7 @@ import { ArtifactSummary, useGetArtifactSummaryQuery } from '@harnessio/react-ha
import { Page } from '@harnessio/uicore'
import { useGetSpaceRef } from '@ar/hooks'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import css from './ArtifactProvider.module.scss'
@ -44,7 +44,7 @@ const ArtifactProvider: FC<PropsWithChildren<{ repoKey: string; artifact: string
refetch
} = useGetArtifactSummaryQuery({
registry_ref: spaceRef,
artifact: encodePathParams(artifact)
artifact: encodeRef(artifact)
})
const responseData = data?.content?.data

View File

@ -19,7 +19,7 @@ import { Page } from '@harnessio/uicore'
import { useGetDockerArtifactManifestsQuery } from '@harnessio/react-har-service-client'
import { useGetSpaceRef } from '@ar/hooks'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import { useStrings } from '@ar/frameworks/strings/String'
import DigestListTable from './components/DigestListTable/DigestListTable'
@ -43,7 +43,7 @@ export default function DigestListPage(props: DigestListPageProps): JSX.Element
refetch
} = useGetDockerArtifactManifestsQuery({
registry_ref: spaceRef,
artifact: encodePathParams(artifact),
artifact: encodeRef(artifact),
version
})

View File

@ -35,6 +35,7 @@ import CreateRepositoryWidget from '@ar/frameworks/RepositoryStep/CreateReposito
import { REPO_KEY_REGEX } from '@ar/constants'
import { useStrings } from '@ar/frameworks/strings'
import { decodeRef } from '@ar/hooks/useGetSpaceRef'
import { useGetSpaceRef } from '@ar/hooks'
import type { FormikFowardRef } from '@ar/common/types'
import { RepositoryPackageType, RepositoryConfigType } from '@ar/common/types'
@ -137,7 +138,7 @@ function RepositoryCreateForm(props: RepositoryCreateFormProps, formikRef: Formi
const response = await createRepository({
body: {
...formattedValuesForCleanupPolicy,
parentRef: decodeURIComponent(parentRef)
parentRef: decodeRef(parentRef)
} as RegistryRequestRequestBody
})
if (response.content.status === 'SUCCESS') {

View File

@ -31,6 +31,7 @@ import { Anonymous, UserPassword, useCreateRegistryMutation } from '@harnessio/r
import { useGetSpaceRef } from '@ar/hooks'
import { useStrings } from '@ar/frameworks/strings'
import { decodeRef } from '@ar/hooks/useGetSpaceRef'
import { setFormikRef } from '@ar/common/utils'
import { REPO_KEY_REGEX, URL_REGEX } from '@ar/constants'
import { Separator } from '@ar/components/Separator/Separator'
@ -138,7 +139,7 @@ function UpstreamProxyCreateForm(props: UpstreamProxyCreateFormProps, formikRef:
const response = await createUpstreamProxy({
body: {
...values,
parentRef: decodeURIComponent(spaceRef)
parentRef: decodeRef(spaceRef)
}
})
if (response.content.status === 'SUCCESS') {

View File

@ -19,7 +19,7 @@ import { defaultTo } from 'lodash-es'
import { Page } from '@harnessio/uicore'
import { useGetDockerArtifactManifestQuery } from '@harnessio/react-har-service-client'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import type { VersionDetailsPathParams } from '@ar/routes/types'
import { useDecodedParams, useGetSpaceRef, useParentHooks } from '@ar/hooks'
@ -42,7 +42,7 @@ export default function DockerManifestDetailsContent(): JSX.Element {
} = useGetDockerArtifactManifestQuery(
{
registry_ref: spaceRef,
artifact: encodePathParams(pathParams.artifactIdentifier),
artifact: encodeRef(pathParams.artifactIdentifier),
version: pathParams.versionIdentifier,
queryParams: {
digest

View File

@ -21,7 +21,7 @@ import { Card, Layout, Page, Text } from '@harnessio/uicore'
import { useGetDockerArtifactLayersQuery } from '@harnessio/react-har-service-client'
import { useStrings } from '@ar/frameworks/strings'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import type { VersionDetailsPathParams } from '@ar/routes/types'
import { useDecodedParams, useGetSpaceRef, useParentHooks } from '@ar/hooks'
import LayersTable from './components/LayersTable/LayersTable'
@ -43,7 +43,7 @@ export default function DockerVersionLayersContent(): JSX.Element {
} = useGetDockerArtifactLayersQuery(
{
registry_ref: spaceRef,
artifact: encodePathParams(pathParams.artifactIdentifier),
artifact: encodeRef(pathParams.artifactIdentifier),
version: pathParams.versionIdentifier,
queryParams: {
digest

View File

@ -20,7 +20,7 @@ import { Card, Container, Layout, Page, Text } from '@harnessio/uicore'
import { useGetDockerArtifactDetailsQuery } from '@harnessio/react-har-service-client'
import { useStrings } from '@ar/frameworks/strings'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import type { VersionDetailsPathParams } from '@ar/routes/types'
import { useDecodedParams, useGetSpaceRef, useParentHooks } from '@ar/hooks'
@ -48,7 +48,7 @@ export default function DockerVersionOSSGeneralInfo({ className }: DockerVersion
} = useGetDockerArtifactDetailsQuery(
{
registry_ref: spaceRef,
artifact: encodePathParams(pathParams.artifactIdentifier),
artifact: encodeRef(pathParams.artifactIdentifier),
version: pathParams.versionIdentifier,
queryParams: {
digest

View File

@ -20,7 +20,7 @@ import { Card, Container, Layout, Page, Text } from '@harnessio/uicore'
import { useGetDockerArtifactDetailsQuery } from '@harnessio/react-har-service-client'
import { useStrings } from '@ar/frameworks/strings'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import { DEFAULT_DATE_TIME_FORMAT } from '@ar/constants'
import type { VersionDetailsPathParams } from '@ar/routes/types'
import { getReadableDateTime } from '@ar/common/dateUtils'
@ -47,7 +47,7 @@ export default function DockerVersionOverviewContent(): JSX.Element {
} = useGetDockerArtifactDetailsQuery(
{
registry_ref: spaceRef,
artifact: encodePathParams(pathParams.artifactIdentifier),
artifact: encodeRef(pathParams.artifactIdentifier),
version: pathParams.versionIdentifier,
queryParams: {
digest

View File

@ -19,7 +19,7 @@ import { debounce } from 'lodash-es'
import { DropDown, SelectOption } from '@harnessio/uicore'
import { useGetDockerArtifactManifestsQuery } from '@harnessio/react-har-service-client'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import { useDecodedParams, useGetSpaceRef } from '@ar/hooks'
import { useStrings } from '@ar/frameworks/strings'
import HeaderTitle from '@ar/components/Header/Title'
@ -46,7 +46,7 @@ export default function ArchitectureSelector(props: ArchitectureSelectorProps):
error
} = useGetDockerArtifactManifestsQuery({
registry_ref: spaceRef,
artifact: encodePathParams(artifactIdentifier),
artifact: encodeRef(artifactIdentifier),
version: version
})

View File

@ -19,7 +19,7 @@ import { defaultTo } from 'lodash-es'
import { Page } from '@harnessio/uicore'
import { useGetHelmArtifactManifestQuery } from '@harnessio/react-har-service-client'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import { useDecodedParams, useGetSpaceRef } from '@ar/hooks'
import type { VersionDetailsPathParams } from '@ar/routes/types'
@ -38,7 +38,7 @@ export default function HelmManifestDetailsContent(): JSX.Element {
refetch
} = useGetHelmArtifactManifestQuery({
registry_ref: spaceRef,
artifact: encodePathParams(pathParams.artifactIdentifier),
artifact: encodeRef(pathParams.artifactIdentifier),
version: pathParams.versionIdentifier
})

View File

@ -19,8 +19,8 @@ import { FontVariation } from '@harnessio/design-system'
import { Card, Container, Layout, Page, Text } from '@harnessio/uicore'
import { useGetHelmArtifactDetailsQuery } from '@harnessio/react-har-service-client'
import { encodePathParams } from '@ar/routes/utils'
import { useStrings } from '@ar/frameworks/strings'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import type { VersionDetailsPathParams } from '@ar/routes/types'
import { useDecodedParams, useGetSpaceRef } from '@ar/hooks'
@ -45,7 +45,7 @@ export default function HelmVersionOSSGeneralInfo(props: HelmVersionOSSGeneralIn
refetch
} = useGetHelmArtifactDetailsQuery({
registry_ref: spaceRef,
artifact: encodePathParams(pathParams.artifactIdentifier),
artifact: encodeRef(pathParams.artifactIdentifier),
version: pathParams.versionIdentifier
})

View File

@ -20,8 +20,8 @@ import { FontVariation } from '@harnessio/design-system'
import { Card, Container, Layout, Page, Text } from '@harnessio/uicore'
import { useGetHelmArtifactDetailsQuery } from '@harnessio/react-har-service-client'
import { encodePathParams } from '@ar/routes/utils'
import { useStrings } from '@ar/frameworks/strings'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import { DEFAULT_DATE_TIME_FORMAT } from '@ar/constants'
import { getReadableDateTime } from '@ar/common/dateUtils'
import type { VersionDetailsPathParams } from '@ar/routes/types'
@ -44,7 +44,7 @@ export default function HelmVersionOverviewContent(): JSX.Element {
refetch
} = useGetHelmArtifactDetailsQuery({
registry_ref: spaceRef,
artifact: encodePathParams(pathParams.artifactIdentifier),
artifact: encodeRef(pathParams.artifactIdentifier),
version: pathParams.versionIdentifier
})

View File

@ -20,7 +20,7 @@ import { GetAllArtifactVersionsOkResponse, getAllArtifactVersions } from '@harne
import { useDecodedParams, useGetSpaceRef } from '@ar/hooks'
import { useStrings } from '@ar/frameworks/strings'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import HeaderTitle from '@ar/components/Header/Title'
import type { VersionDetailsPathParams } from '@ar/routes/types'
@ -41,7 +41,7 @@ export default function VersionSelector(props: VersionSelectorProps): JSX.Elemen
const refetchAllVersions = (): Promise<GetAllArtifactVersionsOkResponse> => {
return getAllArtifactVersions({
registry_ref: spaceRef,
artifact: encodePathParams(artifactIdentifier),
artifact: encodeRef(artifactIdentifier),
queryParams: {
size: 100,
page: 0,

View File

@ -20,7 +20,7 @@ import { Page } from '@harnessio/uicore'
import { ArtifactVersionSummary, useGetArtifactVersionSummaryQuery } from '@harnessio/react-har-service-client'
import { useGetSpaceRef } from '@ar/hooks'
import { encodePathParams } from '@ar/routes/utils'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import css from '../VersionDetails.module.scss'
@ -55,7 +55,7 @@ const VersionProvider: FC<PropsWithChildren<VersionProviderSpcs>> = ({
refetch
} = useGetArtifactVersionSummaryQuery({
registry_ref: spaceRef,
artifact: encodePathParams(artifactKey),
artifact: encodeRef(artifactKey),
version: versionKey
})
const responseData = data?.content?.data

View File

@ -20,8 +20,8 @@ import { Expander } from '@blueprintjs/core'
import { Button, ButtonVariation, ExpandingSearchInput, ExpandingSearchInputHandle, Page } from '@harnessio/uicore'
import { PackageType, useGetAllArtifactVersionsQuery } from '@harnessio/react-har-service-client'
import { encodePathParams } from '@ar/routes/utils'
import { useStrings } from '@ar/frameworks/strings'
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
import { useParentHooks, useDecodedParams, useGetSpaceRef } from '@ar/hooks'
import type { RepositoryPackageType } from '@ar/common/types'
import type { ArtifactDetailsPathParams } from '@ar/routes/types'
@ -65,7 +65,7 @@ function VersionListPage(props: VersionListPageProps): JSX.Element {
error
} = useGetAllArtifactVersionsQuery({
registry_ref: spaceRef,
artifact: encodePathParams(pathParams.artifactIdentifier),
artifact: encodeRef(pathParams.artifactIdentifier),
queryParams: {
page,
size,