aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/src/utils/externalStorageUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/src/utils/externalStorageUtils.ts')
-rw-r--r--apps/files_external/src/utils/externalStorageUtils.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/files_external/src/utils/externalStorageUtils.ts b/apps/files_external/src/utils/externalStorageUtils.ts
new file mode 100644
index 00000000000..4407def5ce7
--- /dev/null
+++ b/apps/files_external/src/utils/externalStorageUtils.ts
@@ -0,0 +1,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'
+}