mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
versionsapi: fix shortPath implementation
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
6dad94137b
commit
f17b40b44a
@ -320,12 +320,14 @@ var (
|
|||||||
func shortPath(ref, stream, version string) string {
|
func shortPath(ref, stream, version string) string {
|
||||||
var sp string
|
var sp string
|
||||||
if ref != ReleaseRef {
|
if ref != ReleaseRef {
|
||||||
sp = path.Join("ref", ref)
|
return path.Join("ref", ref, "stream", stream, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if stream != "stable" {
|
if stream != "stable" {
|
||||||
sp = path.Join(sp, "stream", stream)
|
return path.Join(sp, "stream", stream, version)
|
||||||
}
|
}
|
||||||
return path.Join(sp, version)
|
|
||||||
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseShortPath(shortPath string) (ref, stream, version string, err error) {
|
func parseShortPath(shortPath string) (ref, stream, version string, err error) {
|
||||||
|
@ -607,6 +607,11 @@ func TestShortPath(t *testing.T) {
|
|||||||
stream: "debug",
|
stream: "debug",
|
||||||
version: "v9.9.9",
|
version: "v9.9.9",
|
||||||
},
|
},
|
||||||
|
"ref/foo/stream/stable/v9.9.9": {
|
||||||
|
ref: "foo",
|
||||||
|
stream: "stable",
|
||||||
|
version: "v9.9.9",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, tc := range testCases {
|
for name, tc := range testCases {
|
||||||
|
Loading…
Reference in New Issue
Block a user