From 32d8ef24ef13125c2543c5da1b71d1e498a7b94c Mon Sep 17 00:00:00 2001 From: Chloe Kudryavtsev Date: Wed, 22 Apr 2020 21:36:41 -0400 Subject: [PATCH] feat: allow fetching arbitrary object puburls (#3043) This fix should be backward-compatible, since strings do not need to be initialized by default, and JSON explicitly allows it to be omitted when empty. --- cmd/ls.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/ls.go b/cmd/ls.go index f3f3dfe0..c48fd9f5 100644 --- a/cmd/ls.go +++ b/cmd/ls.go @@ -42,6 +42,7 @@ type contentMessage struct { Size int64 `json:"size"` Key string `json:"key"` ETag string `json:"etag"` + URL string `json:"url,omitempty"` } // String colorized string message. @@ -148,6 +149,9 @@ func doList(clnt Client, isRecursive, isIncomplete bool) error { contentURL = strings.TrimPrefix(contentURL, prefixPath) content.URL.Path = contentURL parsedContent := parseContent(content) + // URL is empty by default + // Set it to either relative dir (host) or public url (remote) + parsedContent.URL = clnt.GetURL().String() // Print colorized or jsonized content info. printMsg(parsedContent) }