diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/actions/editLocallyAction.spec.ts | 3 | ||||
-rw-r--r-- | apps/files/src/actions/editLocallyAction.ts | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/apps/files/src/actions/editLocallyAction.spec.ts b/apps/files/src/actions/editLocallyAction.spec.ts index 4d07bb15189..9c7de1b78be 100644 --- a/apps/files/src/actions/editLocallyAction.spec.ts +++ b/apps/files/src/actions/editLocallyAction.spec.ts @@ -120,6 +120,7 @@ describe('Edit locally action execute tests', () => { data: { ocs: { data: { token: 'foobar' } } }, })) const showError = vi.spyOn(nextcloudDialogs, 'showError') + const windowOpenSpy = vi.spyOn(window, 'open').mockImplementation(() => null) const file = new File({ id: 1, @@ -138,7 +139,7 @@ describe('Edit locally action execute tests', () => { expect(axios.post).toBeCalledTimes(1) expect(axios.post).toBeCalledWith('http://nextcloud.local/ocs/v2.php/apps/files/api/v1/openlocaleditor?format=json', { path: '/foobar.txt' }) expect(showError).toBeCalledTimes(0) - expect(window.location.href).toBe('nc://open/test@nextcloud.local/foobar.txt?token=foobar') + expect(windowOpenSpy).toBeCalledWith('nc://open/test@nextcloud.local/foobar.txt?token=foobar', '_self') }) test('Edit locally fails and shows error', async () => { diff --git a/apps/files/src/actions/editLocallyAction.ts b/apps/files/src/actions/editLocallyAction.ts index 2471eaf40a5..ae35b0ca409 100644 --- a/apps/files/src/actions/editLocallyAction.ts +++ b/apps/files/src/actions/editLocallyAction.ts @@ -73,7 +73,7 @@ const openLocalClient = async function(path: string) { let url = `nc://open/${uid}@` + window.location.host + encodePath(path) url += '?token=' + result.data.ocs.data.token - window.location.href = url + window.open(url, '_self') } catch (error) { showError(t('files', 'Failed to redirect to client')) } |