Skip to content

Commit

Permalink
bugfix(ocm): exclude the local instance in the inviter select
Browse files Browse the repository at this point in the history
  • Loading branch information
fschade committed Sep 10, 2024
1 parent 9322349 commit 9fe099b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
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

0 comments on commit 9fe099b

Please sign in to comment.