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

OCM: Fix open driver #4790

Merged
merged 6 commits into from
Aug 5, 2024
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
8 changes: 8 additions & 0 deletions changelog/unreleased/fix-ocm-open-driver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bugfix: ocm: fixed domain not having a protocol scheme

This PR fixes a bug in the OCM open driver that causes it to be unable to probe
OCM services at the remote server due to the domain having an unsupported
protocol scheme. in this case domain doesn't have a scheme and the changes in
this PR add a scheme to the domain before doing the probe.

https://github.com/cs3org/reva/pull/4790
9 changes: 8 additions & 1 deletion pkg/ocm/provider/authorizer/open/open.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,16 @@ func (a *authorizer) GetInfoByDomain(ctx context.Context, domain string) (*ocmpr
}
}

var endpoint string
if !strings.HasPrefix(domain, "http://") && !strings.HasPrefix(domain, "https://") {
endpoint = "https://" + domain
} else {
endpoint = domain
}

// not yet known: try to discover the remote OCM endpoint
ocmClient := client.NewClient(time.Duration(10)*time.Second, true)
ocmCaps, err := ocmClient.Discover(ctx, domain)
ocmCaps, err := ocmClient.Discover(ctx, endpoint)
if err != nil {
return nil, errors.Wrap(err, "error probing OCM services at remote server")
}
Expand Down
Loading