Skip to content

Commit 1bbfcd5

Browse files
committed
Add custom filename parameter to client
1 parent a686900 commit 1bbfcd5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

client.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,18 @@ func (c *Client) Get() error {
232232
// Destination is the base name of the URL path in "any" mode when
233233
// a file source is detected.
234234
if mode == ClientModeFile {
235-
dst = filepath.Join(dst, filepath.Base(u.Path))
235+
filename := filepath.Base(u.Path)
236+
237+
// Determine if we have a custom file name
238+
if v := q.Get("filename"); v != "" {
239+
// Delete the query parameter if we have it.
240+
q.Del("filename")
241+
u.RawQuery = q.Encode()
242+
243+
filename = v
244+
}
245+
246+
dst = filepath.Join(dst, filename)
236247
}
237248
}
238249

0 commit comments

Comments
 (0)