diff options
| author | Petter Rasmussen | 2015-07-18 16:12:53 +0200 |
|---|---|---|
| committer | Petter Rasmussen | 2015-07-18 16:12:53 +0200 |
| commit | 997a2ea83a6f04177b1264775bb5b0c460fe0be8 (patch) | |
| tree | a622d598e8175046a7708ff50eee3873c894553c | |
| parent | ebac5af855ea43683b67ecbdeb09a7ce1ba61ec6 (diff) | |
| download | gdrive-997a2ea83a6f04177b1264775bb5b0c460fe0be8.tar.bz2 | |
Give proper error when filetype is not supported
| -rw-r--r-- | util/drive.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/util/drive.go b/util/drive.go index d9215ba..a8e7777 100644 --- a/util/drive.go +++ b/util/drive.go @@ -57,7 +57,11 @@ func InternalDownloadUrlAndExtension(info *drive.File, format string) (downloadU // Return DownloadUrl if no format is specified if format == "" { if info.DownloadUrl == "" { - return "", "", fmt.Errorf("A format needs to be specified to download this file (--format). Available formats: %s", strings.Join(availableFormats, ", ")) + if len(availableFormats) > 0 { + return "", "", fmt.Errorf("A format needs to be specified to download this file (--format). Available formats: %s", strings.Join(availableFormats, ", ")) + } else { + return "", "", fmt.Errorf("Download is not supported for this filetype") + } } return info.DownloadUrl, "", nil } |
