@securancy/file-explorer 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,6 +9,7 @@ import { Button, Modal } from "@securancy/svelte-components";
|
|
|
9
9
|
import FileExplorerDirectory from "./FileExplorerDirectory.svelte";
|
|
10
10
|
import { Icon } from "@securancy/svelte-components";
|
|
11
11
|
import { fade } from "svelte/transition";
|
|
12
|
+
import { pathsEqual } from "../utilities";
|
|
12
13
|
export let displayMode = FileExplorerDisplayMode.Columns;
|
|
13
14
|
export let filePath;
|
|
14
15
|
export let documents;
|
|
@@ -75,7 +76,7 @@ async function handleUploadFile(event) {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
async function uploadFilesInternal(request) {
|
|
78
|
-
const filesInDirectory = Array.from(flattenedFiles($documents)).filter((x) => x.path
|
|
79
|
+
const filesInDirectory = Array.from(flattenedFiles($documents)).filter((x) => pathsEqual(x.path, request.path));
|
|
79
80
|
const existingFiles = Array.from(request.files).filter((file) => filesInDirectory.some((document2) => document2.name === file.name));
|
|
80
81
|
if (existingFiles.length > 0) {
|
|
81
82
|
overrideFiles = existingFiles;
|
|
@@ -7,3 +7,4 @@ export declare function isImage(path: string): boolean;
|
|
|
7
7
|
export declare function formatBytes(bytes: number, decimals?: number): string;
|
|
8
8
|
export declare function formatBytesParts(bytes: number, decimals?: number): [number, string];
|
|
9
9
|
export declare function joinPaths(...paths: string[]): string;
|
|
10
|
+
export declare function pathsEqual(path1: string, path2: string): boolean;
|
|
@@ -47,7 +47,13 @@ export function formatBytesParts(bytes, decimals = 2) {
|
|
|
47
47
|
return [Number.parseFloat((bytes / Math.pow(k, index)).toFixed(dm)), sizes[index]];
|
|
48
48
|
}
|
|
49
49
|
export function joinPaths(...paths) {
|
|
50
|
-
return
|
|
50
|
+
return paths
|
|
51
51
|
.map((path) => path.split('/').filter((part) => part !== '').join('/'))
|
|
52
|
+
.filter((path) => path !== '')
|
|
52
53
|
.join('/');
|
|
53
54
|
}
|
|
55
|
+
export function pathsEqual(path1, path2) {
|
|
56
|
+
const path1Parts = path1.split('/').filter((part) => part !== '');
|
|
57
|
+
const path2Parts = path2.split('/').filter((part) => part !== '');
|
|
58
|
+
return path1Parts.length === path2Parts.length && path1Parts.every((part, index) => part === path2Parts[index]);
|
|
59
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@securancy/file-explorer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"svelte": "./dist/index.js",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"vite": "^5.3.4",
|
|
48
48
|
"zod": "^3.23.8",
|
|
49
49
|
"@securancy/eslint-config": "0.2.1",
|
|
50
|
-
"@securancy/svelte-components": "4.3.1",
|
|
51
50
|
"@securancy/stylelint-config": "0.1.2",
|
|
51
|
+
"@securancy/svelte-components": "4.3.2",
|
|
52
52
|
"@securancy/svelte-utilities": "2.0.2"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|