aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Rasmussen2015-07-18 16:12:53 +0200
committerPetter Rasmussen2015-07-18 16:12:53 +0200
commit997a2ea83a6f04177b1264775bb5b0c460fe0be8 (patch)
treea622d598e8175046a7708ff50eee3873c894553c
parentebac5af855ea43683b67ecbdeb09a7ce1ba61ec6 (diff)
downloadgdrive-997a2ea83a6f04177b1264775bb5b0c460fe0be8.tar.bz2
Give proper error when filetype is not supported
-rw-r--r--util/drive.go6
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
}