Skip to content

config.replace is acting weird #2927

@daviddias

Description

@daviddias

Version/Platform/Processor information (from ipfs version --all):

go-ipfs version: 0.4.2-255c6f3
Repo version: 3
System version: amd64/darwin
Golang version: go1.6

Type: bug
Area: api, commands
Priority (from P0: functioning, to P4: operations on fire): P2

Description:

After executing a ipfs config replace, ipfs replaces the config but not to one that was defined and if a ipfs config show is executed after, the Content-Type of the response is text/plain instead of the expected application/json. This breaks js-ipfs-api config.replace feature.

This was detected on: https://github.com/ipfs/js-ipfs-api/pull/307/files#r69281789

How to reproduce using just the ipfs CLI

> ipfs config replace <some random json file, I used a package.json>
> cat ~/.ipfs/config
{
  "API": {
    "HTTPHeaders": null
  },
  "Addresses": {
    "API": "",
    "Gateway": "",
    "Swarm": null
  },
  "Bootstrap": null,
  "Datastore": {
    "GCPeriod": "",
    "NoSync": false,
    "Params": null,
    "Path": "",
    "StorageGCWatermark": 0,
    "StorageMax": "",
    "Type": ""
  },
  "Discovery": {
    "MDNS": {
      "Enabled": false,
      "Interval": 0
    }
  },
  "Gateway": {
    "HTTPHeaders": null,
    "PathPrefixes": null,
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "",
    "PrivKey": ""
  },
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 0
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "",
    "IPNS": ""
  },
  "SupernodeRouting": {
    "Servers": null
  },
  "Swarm": {
    "AddrFilters": null
  },
  "Tour": {
    "Last": ""
  }
}
# Now you can open a tool like Wireshark to check the headers of the following response
> ipfs config show
# ... prints the config again, but the Content-Type was text/plain

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bug in existing code (including security flaws)topic/apiTopic api

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions