diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-10-12 19:44:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-12 19:44:23 +0200 |
commit | eeeade06ebfa9f0f94d776ad4000c440c94fe744 (patch) | |
tree | ccb0ef1ba033c216107b35a381c38ac8436c9ac9 /apps/files/js | |
parent | d936694cdbd600c802a4368166f25d2f802235f5 (diff) | |
parent | edb64b193ce75e827531eedaa90820c9bb6a8054 (diff) | |
download | nextcloud-server-eeeade06ebfa9f0f94d776ad4000c440c94fe744.tar.gz nextcloud-server-eeeade06ebfa9f0f94d776ad4000c440c94fe744.zip |
Merge pull request #34559 from nextcloud/bugfix/noid/require-token-for-local-editing
Require token for local editing
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/filelist.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 2761c3a62b2..7caed29baa3 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -2808,12 +2808,23 @@ }, openLocalClient: function(path) { - var scheme = 'nc://'; - var command = 'open'; - var uid = OC.getCurrentUser().uid; - var url = scheme + command + '/' + uid + '@' + window.location.host + OC.encodePath(path); + var link = OC.linkToOCS('apps/files/api/v1', 2) + 'openlocaleditor?format=json'; - window.location.href = url; + $.post(link, { + path + }) + .success(function(result) { + var scheme = 'nc://'; + var command = 'open'; + var uid = OC.getCurrentUser().uid; + var url = scheme + command + '/' + uid + '@' + window.location.host + OC.encodePath(path); + url += '?token=' + result.ocs.data.token; + + window.location.href = url; + }) + .fail(function() { + OC.Notification.show(t('files', 'Failed to redirect to client')) + }) }, /** |