aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm/manifest.go
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2017-12-13 17:23:11 +0800
committerJanos Guljas <janos@resenje.org>2017-12-13 17:40:39 +0800
commit19982f946735948478b6b7e7706f1b615f171d0d (patch)
treecbacbdb6f9e6e731c2ebc17bad74e875f4d8ea8b /cmd/swarm/manifest.go
parent1dc19de5da64962a98a37bbc7b93a3895d2eb6e6 (diff)
parent32516c768ec09e2a71cab5983d2c8b8ae5d92fc7 (diff)
downloadgo-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.gz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.bz2
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.lz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.xz
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.tar.zst
go-tangerine-19982f946735948478b6b7e7706f1b615f171d0d.zip
swarm, cmd/swarm: Merge branch 'master' into multiple-ens-endpoints
Merge with changes that implement config file PR #15548. Field *EnsApi string* in swarm/api.Config is replaced with *EnsAPIs []string*. A new field *EnsDisabled bool* is added to swarm/api.Config for easy way to disable ENS resolving with config file. Signature of function swarm.NewSwarm is changed and simplified.
Diffstat (limited to 'cmd/swarm/manifest.go')
-rw-r--r--cmd/swarm/manifest.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd/swarm/manifest.go b/cmd/swarm/manifest.go
index 7c4d6052c..aa276e0f9 100644
--- a/cmd/swarm/manifest.go
+++ b/cmd/swarm/manifest.go
@@ -30,6 +30,8 @@ import (
"gopkg.in/urfave/cli.v1"
)
+const bzzManifestJSON = "application/bzz-manifest+json"
+
func add(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 3 {
@@ -145,7 +147,7 @@ func addEntryToManifest(ctx *cli.Context, mhash, path, hash, ctype string) strin
if path == entry.Path {
utils.Fatalf("Path %s already present, not adding anything", path)
} else {
- if entry.ContentType == "application/bzz-manifest+json" {
+ if entry.ContentType == bzzManifestJSON {
prfxlen := strings.HasPrefix(path, entry.Path)
if prfxlen && len(path) > len(longestPathEntry.Path) {
longestPathEntry = entry
@@ -207,7 +209,7 @@ func updateEntryInManifest(ctx *cli.Context, mhash, path, hash, ctype string) st
if path == entry.Path {
newEntry = entry
} else {
- if entry.ContentType == "application/bzz-manifest+json" {
+ if entry.ContentType == bzzManifestJSON {
prfxlen := strings.HasPrefix(path, entry.Path)
if prfxlen && len(path) > len(longestPathEntry.Path) {
longestPathEntry = entry
@@ -281,7 +283,7 @@ func removeEntryFromManifest(ctx *cli.Context, mhash, path string) string {
if path == entry.Path {
entryToRemove = entry
} else {
- if entry.ContentType == "application/bzz-manifest+json" {
+ if entry.ContentType == bzzManifestJSON {
prfxlen := strings.HasPrefix(path, entry.Path)
if prfxlen && len(path) > len(longestPathEntry.Path) {
longestPathEntry = entry