aboutsummaryrefslogtreecommitdiffstats
path: root/cli/cli.go
diff options
context:
space:
mode:
authorNorman Casagrande2014-02-18 12:01:37 +0000
committerNorman Casagrande2014-02-18 12:01:37 +0000
commitf1f81fce96c711c6f6e59d1907966ae2418bea98 (patch)
treecf3dc723e8a21ca3a85fb8a35b6fb3aa9bd1470b /cli/cli.go
parent0fa147d4fb2e264ceb53521c9d0b21e322753698 (diff)
downloadgdrive-f1f81fce96c711c6f6e59d1907966ae2418bea98.tar.bz2
Added support for mime types while uploading
Diffstat (limited to 'cli/cli.go')
-rw-r--r--cli/cli.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/cli/cli.go b/cli/cli.go
index 58dfd28..6e95f59 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -158,7 +158,7 @@ func Folder(d *gdrive.Drive, title string, parentId string, share bool) {
}
// Upload file to drive
-func Upload(d *gdrive.Drive, input io.ReadCloser, title string, parentId string, share bool) {
+func Upload(d *gdrive.Drive, input io.ReadCloser, title string, parentId string, share bool, mimeType string) {
// Use filename or 'untitled' as title if no title is specified
if title == "" {
if f, ok := input.(*os.File); ok && input != os.Stdin {
@@ -168,7 +168,10 @@ func Upload(d *gdrive.Drive, input io.ReadCloser, title string, parentId string,
}
}
- var mimeType = mime.TypeByExtension(filepath.Ext(title))
+ if mimeType == "" {
+ mimeType = mime.TypeByExtension(filepath.Ext(title))
+ }
+
// File instance
f := &drive.File{Title: title, MimeType: mimeType}
// Set parent (if provided)