8000 refactor: support percent-encoded /unix paths by lidel · Pull Request #10833 · ipfs/kubo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor: support percent-encoded /unix paths #10833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lidel
Copy link
Member
@lidel lidel commented Jun 9, 2025

Why

is breaking spec change that is incompatible with existing feature in Kubo, where users were able to provide old notation of /unix multiaddrs in both Addresses.API and Addresses.Gateway.

How

This is a PoC that aims to support
multiformats/multiaddr#174 while not breaking existing Kubo users.

TODO

This is a PoC that aims to support
multiformats/multiaddr#174
while not breaking existing Kubo users.

See TODO in daemon.go – likely we want to move this to
https://github.com/multiformats/go-multiaddr
@lidel lidel added the skip/changelog This change does NOT require a changelog entry label Jun 9, 2025
Comment on lines +709 to +726
// TODO: should a version of this live in https://github.com/multiformats/go-multiaddr
// so we dont need to duplicate code here and in client/rpc/api.go ?
func NormalizeUnixMultiaddr(address string) string {
// Support legacy and modern /unix addrs
// https://github.com/multiformats/multiaddr/pull/174
socketPath, err := url.PathUnescape(address)
if err != nil {
return address // nil, fmt.Errorf("failed to unescape /unix socket path: %w", err)
}
// Ensure the path is absolute
if !strings.HasPrefix(socketPath, string(filepath.Separator)) {
socketPath = string(filepath.Separator) + socketPath
}
// Normalize path
socketPath = filepath.Clean(socketPath)
return socketPath
}

Copy link
Member Author
@lidel lidel Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ @gammazero @MarcoPolo Thoughts on if this should live in go-multiaddr, or here?

IF It does not live in https://github.com/multiformats/go-multiaddr then multiformats/multiaddr#174 is effectively a dead spec IMO, because nobody will use percent-encoded version.

@lidel lidel mentioned this pull request Jun 9, 2025
39 tasks
if err != nil {
return address // nil, fmt.Errorf("failed to unescape /unix socket path: %w", err)
}
// Ensure the path is absolute
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N.b. in the latest version of the spec pr, relative paths are supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip/changelog This change does NOT require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0