Skip to content

Commit 0f341e4

Browse files
committed
fix(files_sharing): only offer folders in file-request which are shareable
This resolves issues with e2ee. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 35333ce commit 0f341e4

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

apps/files_sharing/src/components/NewFileRequestDialog.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,14 @@ export default defineComponent({
197197
},
198198
199199
data() {
200+
const destination = (this.context.permissions & Permission.SHARE)
201+
? this.context.path
202+
: '/'
200203
return {
201204
currentStep: STEP.FIRST,
202205
loading: false,
203206
204-
destination: this.context.path || '/',
207+
destination,
205208
label: '',
206209
note: '',
207210

apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@
7373
</template>
7474

7575
<script lang="ts">
76-
import type { Folder, Node } from '@nextcloud/files'
76+
import type { Folder, INode } from '@nextcloud/files'
7777
import type { PropType } from 'vue'
7878
7979
import { getFilePickerBuilder } from '@nextcloud/dialogs'
80+
import { Permission } from '@nextcloud/files'
8081
import { t } from '@nextcloud/l10n'
8182
import { defineComponent } from 'vue'
8283
import NcTextArea from '@nextcloud/vue/components/NcTextArea'
@@ -146,6 +147,10 @@ export default defineComponent({
146147
callback: this.onPickedDestination,
147148
})
148149
.setFilter((node) => node.path !== '/')
150+
.setCanPick((node) => {
151+
console.error('onPickDestination.canPick', node.path, node.permissions, Boolean(node.permissions & Permission.SHARE))
152+
return Boolean(node.permissions & Permission.SHARE)
153+
})
149154
.startAt(this.destination)
150155
.build()
151156
try {
@@ -155,7 +160,7 @@ export default defineComponent({
155160
}
156161
},
157162
158-
onPickedDestination(nodes: Node[]) {
163+
onPickedDestination(nodes: INode[]) {
159164
const node = nodes[0]
160165
if (node) {
161166
this.$emit('update:destination', node.path)

0 commit comments

Comments
 (0)