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

bugfix(ocm): exclude the local instance in the inviter select #11560

Merged
merged 1 commit into from
Sep 10, 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
5 changes: 5 additions & 0 deletions changelog/unreleased/bugfix-ocm-local-instance-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: OCM local instance check

We've fixed the issue where the current instance was not recognized as a local instance in inviter select.

https://github.com/owncloud/web/pull/11560
19 changes: 17 additions & 2 deletions packages/web-app-ocm/src/views/IncomingInvitations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<span class="option" v-text="domain" />
</div>
</template>
<template #no-options> No institutions found with this name </template>
<template #no-options> No institutions found with this name</template>
<template #selected-option="{ full_name, domain }">
<div class="options-wrapper oc-text-break">
<strong class="oc-mr-s oc-text-break" v-text="full_name" />
Expand Down Expand Up @@ -155,7 +155,22 @@ export default defineComponent({
}
}
const isMyProviderSelectedProvider = (p: ProviderSchema) => {
return p.domain === new URL(configStore.serverUrl).hostname
// the protocol is not important, we just need the host and port, it's there to make it compatible with URL
const toURL = (purl: string) =>
new URL(purl.split('://').length === 1 ? `https://${purl}` : purl)
const { host: configStoreHost, port: configStorePort } = toURL(configStore.serverUrl)
const { host: providerSchemaHost, port: providerSchemaPort } = toURL(p.domain)

return [
// ensure that the config store host is not empty, minimal check
!!configStoreHost,
// ensure that the provider schema host is not empty, minimal check
!!providerSchemaHost,
// check if the host is the same
configStoreHost === providerSchemaHost,
// also check the port, multiple instances can run on the same host but not on the same port...
configStorePort === providerSchemaPort
].every((c) => c)
}

const handleParams = (to: RouteLocationNormalized) => {
Expand Down