Skip to content

Commit d39b28a

Browse files
committed
fix(NcReferenceList): Use getSharingToken() from @nextcloud/sharing
Signed-off-by: Jonas <[email protected]>
1 parent 99c97ba commit d39b28a

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

package-lock.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"@nextcloud/l10n": "^3.0.1",
7676
"@nextcloud/logger": "^3.0.1",
7777
"@nextcloud/router": "^3.0.0",
78+
"@nextcloud/sharing": "^0.2.2",
7879
"@nextcloud/timezones": "^0.1.1",
7980
"@nextcloud/vue-select": "^3.25.0",
8081
"@vueuse/components": "^10.9.0",

src/components/NcRichText/NcReferenceList.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import NcReferenceWidget from './NcReferenceWidget.vue'
1515
import { URL_PATTERN } from './helpers.js'
1616

1717
import axios from '@nextcloud/axios'
18+
import { getSharingToken } from '@nextcloud/sharing/public'
1819
import { getCurrentUser } from '@nextcloud/auth'
1920
import { generateOcsUrl } from '@nextcloud/router'
2021

@@ -120,10 +121,9 @@ export default {
120121
resolve() {
121122
const match = (new RegExp(URL_PATTERN).exec(this.text.trim()))
122123
const isPublic = getCurrentUser() === null
123-
const sharingToken = document.getElementById('sharingToken')?.value || ''
124124
if (this.limit === 1 && match) {
125125
return isPublic
126-
? axios.get(generateOcsUrl('references/resolvePublic') + `?reference=${encodeURIComponent(match[0])}&sharingToken=${sharingToken}`)
126+
? axios.get(generateOcsUrl('references/resolvePublic') + `?reference=${encodeURIComponent(match[0])}&sharingToken=${getSharingToken()}`)
127127
: axios.get(generateOcsUrl('references/resolve') + `?reference=${encodeURIComponent(match[0])}`)
128128
}
129129

@@ -132,7 +132,7 @@ export default {
132132
text: this.text,
133133
resolve: true,
134134
limit: this.limit,
135-
sharingToken,
135+
sharingToken: getSharingToken(),
136136
})
137137
: axios.post(generateOcsUrl('references/extract'), {
138138
text: this.text,

0 commit comments

Comments
 (0)