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.
This commit is contained in:
Chloe Kudryavtsev
2020-04-22 18:36:41 -07:00
committed by GitHub
parent f82a7b13c1
commit 32d8ef24ef
+4
View File
@@ -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)
}