MCPcopy Create free account
hub / github.com/MG-RAST/Shock / buildDownloadUrl

Function buildDownloadUrl

shock-client/util.go:88–112  ·  view source on GitHub ↗
(host string, id string)

Source from the content-addressed store, hash-verified

86}
87
88func buildDownloadUrl(host string, id string) string {
89 query := url.Values{}
90 query.Add("download", "")
91
92 if (index != "") && (parts != "") {
93 if !validateCV("index", index) {
94 exitError("invalid index type")
95 }
96 query.Add("index", index)
97 query.Add("part", parts)
98 } else if (seek > -1) && (length > 0) {
99 query.Add("seek", strconv.Itoa(seek))
100 query.Add("length", strconv.Itoa(length))
101 }
102
103 var myurl *url.URL
104 myurl, err := url.ParseRequestURI(host)
105 if err != nil {
106 exitError("error parsing shock url")
107 }
108 (*myurl).Path = "/node/" + id
109 (*myurl).RawQuery = query.Encode()
110
111 return myurl.String()
112}
113
114func isDir(d string) bool {
115 fi, err := os.Stat(d)

Callers 1

mainFunction · 0.85

Calls 4

validateCVFunction · 0.85
exitErrorFunction · 0.85
AddMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected