Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Kubo Changelogs

- [v0.37](docs/changelogs/v0.37.md)
- [v0.36](docs/changelogs/v0.36.md)
- [v0.35](docs/changelogs/v0.35.md)
- [v0.34](docs/changelogs/v0.34.md)
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ From there:
- Open/extract the archive.
- Move kubo (`ipfs`) to your path (`install.sh` can do it for you).

If you are unable to access [dist.ipfs.tech](https://dist.ipfs.tech#kubo), you can also download kubo (go-ipfs) from:
If you are unable to access [dist.ipfs.tech](https://dist.ipfs.tech#kubo), you can also download kubo from:
- this project's GitHub [releases](https://github.com/ipfs/kubo/releases/latest) page
- `/ipns/dist.ipfs.tech` at [dweb.link](https://dweb.link/ipns/dist.ipfs.tech#kubo) gateway

#### Updating

##### Downloading builds using IPFS

List the available versions of Kubo (go-ipfs) implementation:
List the available versions of Kubo implementation:

```console
$ ipfs cat /ipns/dist.ipfs.tech/kubo/versions
Expand Down Expand Up @@ -238,7 +238,7 @@ https://packages.gentoo.org/packages/net-p2p/kubo

#### <a name="nix-linux">Nix</a>

With the purely functional package manager [Nix](https://nixos.org/nix/) you can install kubo (go-ipfs) like this:
With the purely functional package manager [Nix](https://nixos.org/nix/) you can install kubo like this:

```
$ nix-env -i kubo
Expand All @@ -258,11 +258,11 @@ You can also install it through the Solus software center.

#### openSUSE

[Community Package for go-ipfs](https://software.opensuse.org/package/go-ipfs)
[Community Package for kubo](https://software.opensuse.org/package/kubo)

#### Guix

[Community Package for go-ipfs](https://packages.guix.gnu.org/packages/go-ipfs/0.11.0/) is now out-of-date.
[Community Package for kubo](https://packages.guix.gnu.org/search/?query=kubo) is available.

#### Snap

Expand Down Expand Up @@ -323,7 +323,7 @@ PS> scoop install kubo

#### MacPorts

The package [ipfs](https://ports.macports.org/port/ipfs) currently points to kubo (go-ipfs) and is being maintained.
The package [ipfs](https://ports.macports.org/port/ipfs) currently points to kubo and is being maintained.

```
$ sudo port install ipfs
Expand Down Expand Up @@ -383,7 +383,7 @@ $ cd kubo
$ make install
```

Alternatively, you can run `make build` to build the go-ipfs binary (storing it in `cmd/ipfs/ipfs`) without installing it.
Alternatively, you can run `make build` to build the kubo binary (storing it in `cmd/ipfs/ipfs`) without installing it.

**NOTE:** If you get an error along the lines of "fatal error: stdlib.h: No such file or directory", you're missing a C compiler. Either re-run `make` with `CGO_ENABLED=0` or install GCC.

Expand All @@ -400,7 +400,7 @@ make build GOOS=myTargetOS GOARCH=myTargetArchitecture
- Separate [instructions are available for building on Windows](docs/windows.md).
- `git` is required in order for `go get` to fetch all dependencies.
- Package managers often contain out-of-date `golang` packages.
Ensure that `go version` reports at least 1.10. See above for how to install go.
Ensure that `go version` reports the minimum version required (see go.mod). See above for how to install go.
- If you are interested in development, please install the development
dependencies as well.
- Shell command completions can be generated with one of the `ipfs commands completion` subcommands. Read [docs/command-completion.md](docs/command-completion.md) to learn more.
Expand All @@ -418,6 +418,8 @@ system, this is done with `ipfs init`. See `ipfs init --help` for information on
the optional arguments it takes. After initialization is complete, you can use
`ipfs mount`, `ipfs add` and any of the other commands to explore!

For detailed configuration options, see [docs/config.md](https://github.com/ipfs/kubo/blob/master/docs/config.md).

### Some things to try

Basic proof of 'ipfs working' locally:
Expand All @@ -436,6 +438,8 @@ For programmatic interaction with Kubo, see our [list of HTTP/RPC clients](docs/

If you have previously installed IPFS before and you are running into problems getting a newer version to work, try deleting (or backing up somewhere else) your IPFS config directory (~/.ipfs by default) and rerunning `ipfs init`. This will reinitialize the config file to its defaults and clear out the local datastore of any bad entries.

For more information about configuration options, see [docs/config.md](https://github.com/ipfs/kubo/blob/master/docs/config.md).

Please direct general questions and help requests to our [forums](https://discuss.ipfs.tech).

If you believe you've found a bug, check the [issues list](https://github.com/ipfs/kubo/issues) and, if you don't see your problem there, either come talk to us on [Matrix chat](https://docs.ipfs.tech/community/chat/), or file an issue of your own!
Expand Down
7 changes: 6 additions & 1 deletion core/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,13 +506,18 @@ func setConfig(r repo.Repo, key string, value interface{}) (*ConfigField, error)
return getConfig(r, key)
}

// parseEditorCommand parses the EDITOR environment variable into command and arguments
func parseEditorCommand(editor string) ([]string, error) {
return shlex.Split(editor, true)
}

func editConfig(filename string) error {
editor := os.Getenv("EDITOR")
if editor == "" {
return errors.New("ENV variable $EDITOR not set")
}

editorAndArgs, err := shlex.Split(editor, true)
editorAndArgs, err := parseEditorCommand(editor)
if err != nil {
return fmt.Errorf("cannot parse $EDITOR value: %s", err)
}
Expand Down
113 changes: 113 additions & 0 deletions core/commands/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,116 @@ func TestScrubMapInternalDelete(t *testing.T) {
t.Errorf("expecting an empty map, got a non-empty map")
}
}

func TestEditorParsing(t *testing.T) {
testCases := []struct {
name string
input string
expected []string
hasError bool
}{
{
name: "simple editor",
input: "vim",
expected: []string{"vim"},
hasError: false,
},
{
name: "editor with single flag",
input: "emacs -nw",
expected: []string{"emacs", "-nw"},
hasError: false,
},
{
name: "VS Code with wait flag (issue #9375)",
input: "code --wait",
expected: []string{"code", "--wait"},
hasError: false,
},
{
name: "VS Code with full path and wait flag (issue #9375)",
input: "/opt/homebrew/bin/code --wait",
expected: []string{"/opt/homebrew/bin/code", "--wait"},
hasError: false,
},
{
name: "editor with quoted path containing spaces",
input: "\"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code\" --wait",
expected: []string{"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code", "--wait"},
hasError: false,
},
{
name: "sublime text with wait flag",
input: "subl -w",
expected: []string{"subl", "-w"},
hasError: false,
},
{
name: "nano editor",
input: "nano",
expected: []string{"nano"},
hasError: false,
},
{
name: "gedit editor",
input: "gedit",
expected: []string{"gedit"},
hasError: false,
},
{
name: "editor with multiple flags",
input: "vim -c 'set number' -c 'set hlsearch'",
expected: []string{"vim", "-c", "set number", "-c", "set hlsearch"},
hasError: false,
},
{
name: "trailing backslash (POSIX edge case)",
input: "editor\\",
expected: nil,
hasError: true,
},
{
name: "double quoted editor name with spaces",
input: "\"code with spaces\" --wait",
expected: []string{"code with spaces", "--wait"},
hasError: false,
},
{
name: "single quoted editor with flags",
input: "'my editor' -flag",
expected: []string{"my editor", "-flag"},
hasError: false,
},
}

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
result, err := parseEditorCommand(tc.input)

if tc.hasError {
if err == nil {
t.Errorf("Expected error for input '%s', but got none", tc.input)
}
return
}

if err != nil {
t.Errorf("Unexpected error for input '%s': %v", tc.input, err)
return
}

if len(result) != len(tc.expected) {
t.Errorf("Expected %d args, got %d for input '%s'", len(tc.expected), len(result), tc.input)
t.Errorf("Expected: %v", tc.expected)
t.Errorf("Got: %v", result)
return
}

for i, expected := range tc.expected {
if result[i] != expected {
t.Errorf("Expected arg %d to be '%s', got '%s' for input '%s'", i, expected, result[i], tc.input)
}
}
})
}
}
1 change: 1 addition & 0 deletions core/node/bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func Bitswap(serverEnabled, libp2pEnabled, httpEnabled bool) interface{} {
httpnet.WithInsecureSkipVerify(httpCfg.TLSInsecureSkipVerify.WithDefault(config.DefaultHTTPRetrievalTLSInsecureSkipVerify)),
httpnet.WithMaxBlockSize(int64(maxBlockSize)),
httpnet.WithUserAgent(version.GetUserAgentVersion()),
httpnet.WithMetricsLabelsForEndpoints(httpCfg.Allowlist),
)
bitswapNetworks = network.New(in.Host.Peerstore(), bitswapLibp2p, bitswapHTTP)
} else if libp2pEnabled {
Expand Down
Loading
Loading