aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drive/import.go8
-rw-r--r--drive/sync_upload.go2
-rw-r--r--gdrive.go5
-rw-r--r--handlers_drive.go1
4 files changed, 13 insertions, 3 deletions
diff --git a/drive/import.go b/drive/import.go
index 2ee5f1e..0162aa3 100644
--- a/drive/import.go
+++ b/drive/import.go
@@ -11,15 +11,19 @@ import (
type ImportArgs struct {
Out io.Writer
+ Mime string
Progress io.Writer
Path string
Parents []string
}
func (self *Drive) Import(args ImportArgs) error {
- fromMime := getMimeType(args.Path)
+ fromMime := args.Mime
if fromMime == "" {
- return fmt.Errorf("Could not determine mime type of file")
+ fromMime = getMimeType(args.Path)
+ }
+ if fromMime == "" {
+ return fmt.Errorf("Could not determine mime type of file, use --mime")
}
about, err := self.service.About.Get().Fields("importFormats").Do()
diff --git a/drive/sync_upload.go b/drive/sync_upload.go
index 261497d..f1e43a4 100644
--- a/drive/sync_upload.go
+++ b/drive/sync_upload.go
@@ -120,7 +120,7 @@ func (self *Drive) prepareSyncRoot(args UploadSyncArgs) (*drive.File, error) {
// Ensure that the directory is empty
if !isEmpty {
- return nil, fmt.Errorf("Root directoy is not empty, the initial sync requires an empty directory")
+ return nil, fmt.Errorf("Root directory is not empty, the initial sync requires an empty directory")
}
// Update directory with syncRoot property
diff --git a/gdrive.go b/gdrive.go
index b607827..272a9e9 100644
--- a/gdrive.go
+++ b/gdrive.go
@@ -724,6 +724,11 @@ func main() {
Description: "Hide progress",
OmitValue: true,
},
+ cli.StringFlag{
+ Name: "mime",
+ Patterns: []string{"--mime"},
+ Description: "Mime type of imported file",
+ },
),
},
},
diff --git a/handlers_drive.go b/handlers_drive.go
index 07c12d4..516feff 100644
--- a/handlers_drive.go
+++ b/handlers_drive.go
@@ -190,6 +190,7 @@ func infoHandler(ctx cli.Context) {
func importHandler(ctx cli.Context) {
args := ctx.Args()
err := newDrive(args).Import(drive.ImportArgs{
+ Mime: args.String("mime"),
Out: os.Stdout,
Path: args.String("path"),
Parents: args.StringSlice("parent"),