Skip to content

Commit 7bd5b8e

Browse files
committed
fix(static-route): fixes the name to guid behaviour for hyphenated names
The current logic for name_to_guid and list logic makes the assumption that static-routes are not hyphenated. It only makes the split and only shows the first part. Originally the idea was to get rid of the automatically generated prefix and only work with the names. This also is a problem because users see different behaviour on the Web UI and CLI. This commit fixes this behaviour to make it similar to the Web UI.
1 parent 5f76295 commit 7bd5b8e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

riocli/static_route/util.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,15 @@ def get_static_route_name(client: Client, guid: str) -> str:
5353
def find_static_route_guid(client: Client, name: str) -> str:
5454
routes = client.get_all_static_routes()
5555
for route in routes:
56-
prefix = route.urlPrefix.split("-")[0]
57-
if prefix == name or route.urlString == name:
56+
if route.urlPrefix == name or route.urlString == name:
5857
return route.guid
5958

6059
click.secho("Static route not found", fg='red')
6160
exit(1)
6261

6362

6463
def repr_static_routes(routes: typing.List[StaticRoute]) -> None:
65-
header = '{:<36} {:<15} {:25} {:36} {:32}'.format(
64+
header = '{:<36} {:<25} {:36} {:36} {:32}'.format(
6665
'Static Route ID',
6766
'Name',
6867
'Full URL',
@@ -72,6 +71,6 @@ def repr_static_routes(routes: typing.List[StaticRoute]) -> None:
7271
click.echo(click.style(header, fg='yellow'))
7372
for route in routes:
7473
click.secho(
75-
'{:<36} {:<15} {:25} {:36} {:32}'.
76-
format(route.guid, route.urlPrefix.split("-")[0], route.urlString, route.creator,
74+
'{:<36} {:<25} {:36} {:36} {:32}'.
75+
format(route.guid, route.urlPrefix, route.urlString, route.creator,
7776
route.CreatedAt))

0 commit comments

Comments
 (0)