Skip to content

Commit 1d20f75

Browse files
committed
fix(web-app-files): [OCISDEV-451] external share ID fallback
Fallback to original ID if decoding the external share ID fails.
1 parent 80317b4 commit 1d20f75

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Bugfix: External share ID fallback
2+
3+
We now fallback to the original ID if decoding the external share ID fails.
4+
5+
https://github.com/owncloud/web/pull/13253

packages/web-app-files/src/components/SideBar/Shares/Collaborators/ListItem.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,14 @@ const shareOwnerDisplayName = computed(() => share.sharedBy.displayName)
287287
288288
const externalShareDomainName = computed(() => {
289289
if (unref(isExternalShare)) {
290-
const decodedId = atob(share.sharedWith.id)
290+
let decodedId = ''
291+
292+
try {
293+
decodedId = atob(share.sharedWith.id)
294+
} catch (_) {
295+
decodedId = share.sharedWith.id
296+
}
297+
291298
const [, serverUrl] = decodedId.split('@')
292299
const domain = new URL(serverUrl).hostname
293300

packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/ListItem.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,17 @@ describe('Collaborator ListItem component', () => {
206206

207207
expect(el.text()).toEqual('www.lorem.com')
208208
})
209+
210+
it('should fallback to original ID if decoding fails', () => {
211+
const share = getShareMock({
212+
shareType: ShareTypes.remote.value,
213+
sharedWith: { id: 'einstein@https://www.lorem.com', displayName: 'einstein' }
214+
})
215+
const { wrapper } = createWrapper({ share })
216+
const el = wrapper.find('[data-testid="external-share-domain"]')
217+
218+
expect(el.text()).toEqual('www.lorem.com')
219+
})
209220
})
210221
})
211222

0 commit comments

Comments
 (0)