aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/src/utils/externalStorageUtils.ts
blob: 4407def5ce7083a0fe1e386b5d635af7c778c1bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
import { FileType, Node } from '@nextcloud/files'
import type { MountEntry } from '../services/externalStorage'

export const isNodeExternalStorage = function(node: Node) {
	// Not a folder, not a storage
	if (node.type === FileType.File) {
		 return false
	}

	// No backend or scope, not a storage
	const attributes = node.attributes as MountEntry
	if (!attributes.scope || !attributes.backend) {
		return false
	}

	// Specific markers that we're sure are ext storage only
	return attributes.scope === 'personal' || attributes.scope === 'system'
}