Skip to content
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

fix: PersistedShard.URL should do QueryUnescape before url.Parse. #158

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion shard_persist.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,20 @@ func (s *Shard) UnmarshalJSON(b []byte) error {
}

// restore mount.
u, err := url.Parse(ps.URL)
// URL should do QueryUnescape first.
urlStr, err := url.QueryUnescape(ps.URL)
if err != nil {
return fmt.Errorf("failed to query unescape URL : %w", err)
}
u, err := url.Parse(urlStr)
if err != nil {
return fmt.Errorf("failed to parse mount URL: %w", err)
}

if u.Host == "" {
u.Host = u.Path
}

mnt, err := s.d.mounts.Instantiate(u)
if err != nil {
return fmt.Errorf("failed to instantiate mount from URL: %w", err)
Expand Down