From b9979d969d6779fa3558121bcacf8b3149f98d6f Mon Sep 17 00:00:00 2001 From: Arnaud Ysmal Date: Thu, 26 Feb 2015 19:27:41 +0100 Subject: [PATCH] Fix sharing file without short URL (Fix #16) --- dropbox.go | 4 +--- dropbox_test.go | 11 +++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dropbox.go b/dropbox.go index 63d77a2..50f12db 100644 --- a/dropbox.go +++ b/dropbox.go @@ -645,9 +645,7 @@ func (db *Dropbox) Shares(path string, shortURL bool) (*Link, error) { var rv Link var params *url.Values - if shortURL { - params = &url.Values{"short_url": {strconv.FormatBool(shortURL)}} - } + params = &url.Values{"short_url": {strconv.FormatBool(shortURL)}} act := strings.Join([]string{"shares", db.RootDirectory, path}, "/") err := db.doRequest("POST", act, params, &rv) return &rv, err diff --git a/dropbox_test.go b/dropbox_test.go index e78dfa1..d52ccae 100644 --- a/dropbox_test.go +++ b/dropbox_test.go @@ -695,10 +695,13 @@ func TestShares(t *testing.T) { t.Fatalf("could not run test due to marshalling issue") } fake := FakeHTTP{ - Method: "POST", - Host: "api.dropbox.com", - Path: "/1/shares/auto/" + filename, - Params: map[string]string{"locale": "en"}, + Method: "POST", + Host: "api.dropbox.com", + Path: "/1/shares/auto/" + filename, + Params: map[string]string{ + "locale": "en", + "short_url": "false", + }, t: t, ResponseData: js, }