aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm/upload.go
diff options
context:
space:
mode:
authorViktor TrĂ³n <viktor.tron@gmail.com>2018-06-22 05:00:43 +0800
committerGitHub <noreply@github.com>2018-06-22 05:00:43 +0800
commiteaff89291ce998ba4bf9b9816ca8a15c8b85f440 (patch)
treec77d7a06627a1a7f578d0fec8e39788e66672e53 /cmd/swarm/upload.go
parentd926bf2c7e3182d694c15829a37a0ca7331cd03c (diff)
parente187711c6545487d4cac3701f0f506bb536234e2 (diff)
downloadgo-tangerine-eaff89291ce998ba4bf9b9816ca8a15c8b85f440.tar.gz
go-tangerine-eaff89291ce998ba4bf9b9816ca8a15c8b85f440.tar.zst
go-tangerine-eaff89291ce998ba4bf9b9816ca8a15c8b85f440.zip
Merge pull request #17041 from ethersphere/swarm-network-rewrite-merge
Swarm POC3 - happy solstice
Diffstat (limited to 'cmd/swarm/upload.go')
-rw-r--r--cmd/swarm/upload.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/swarm/upload.go b/cmd/swarm/upload.go
index 9f4c525bb..8ba0e7c5f 100644
--- a/cmd/swarm/upload.go
+++ b/cmd/swarm/upload.go
@@ -40,12 +40,13 @@ func upload(ctx *cli.Context) {
args := ctx.Args()
var (
bzzapi = strings.TrimRight(ctx.GlobalString(SwarmApiFlag.Name), "/")
- recursive = ctx.GlobalBool(SwarmRecursiveUploadFlag.Name)
+ recursive = ctx.GlobalBool(SwarmRecursiveFlag.Name)
wantManifest = ctx.GlobalBoolT(SwarmWantManifestFlag.Name)
defaultPath = ctx.GlobalString(SwarmUploadDefaultPath.Name)
fromStdin = ctx.GlobalBool(SwarmUpFromStdinFlag.Name)
mimeType = ctx.GlobalString(SwarmUploadMimeType.Name)
client = swarm.NewClient(bzzapi)
+ toEncrypt = ctx.Bool(SwarmEncryptedFlag.Name)
file string
)
@@ -76,7 +77,7 @@ func upload(ctx *cli.Context) {
utils.Fatalf("Error opening file: %s", err)
}
defer f.Close()
- hash, err := client.UploadRaw(f, f.Size)
+ hash, err := client.UploadRaw(f, f.Size, toEncrypt)
if err != nil {
utils.Fatalf("Upload failed: %s", err)
}
@@ -97,7 +98,7 @@ func upload(ctx *cli.Context) {
if !recursive {
return "", errors.New("Argument is a directory and recursive upload is disabled")
}
- return client.UploadDirectory(file, defaultPath, "")
+ return client.UploadDirectory(file, defaultPath, "", toEncrypt)
}
} else {
doUpload = func() (string, error) {
@@ -110,7 +111,7 @@ func upload(ctx *cli.Context) {
mimeType = detectMimeType(file)
}
f.ContentType = mimeType
- return client.Upload(f, "")
+ return client.Upload(f, "", toEncrypt)
}
}
hash, err := doUpload()