refac
This commit is contained in:
1 parent
302ffc8b7e
commit
d7d935275a
2 files changed
+24
-21
No files matched your search
@@ -1173,20 +1173,21 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastSlash = filePath.lastIndexOf('/');
|
const lastSlash = filePath.lastIndexOf('/');
|
||||||
const dir = lastSlash > 0 ? filePath.substring(0, lastSlash + 1) : '/';
|
const dir = lastSlash > 0 ? filePath.substring(0, lastSlash + 1) : '/';
|
||||||
|
invalidateTreeCache(dir);
|
||||||
|
|
||||||
if (selectedFile) {
|
if (selectedFile) {
|
||||||
if (selectedFile === filePath || currentPath.startsWith(dir)) {
|
if (selectedFile === filePath || currentPath.startsWith(dir)) {
|
||||||
const fileName = selectedFile.split('/').pop() ?? '';
|
const fileName = selectedFile.split('/').pop() ?? '';
|
||||||
await openEntry({ name: fileName, type: 'file', size: 0 });
|
await openEntry({ name: fileName, type: 'file', size: 0 });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (currentPath.startsWith(dir) || dir.startsWith(currentPath)) {
|
if (currentPath.startsWith(dir) || dir.startsWith(currentPath)) {
|
||||||
await loadDir(currentPath, { preserveTree: true });
|
await refreshBrowser();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
if (!handledDisplayFile && terminal) {
|
if (!handledDisplayFile && terminal) {
|
||||||
loading = true;
|
loading = true;
|
||||||
|
|||||||
@@ -33,11 +33,12 @@
|
|||||||
toolServers,
|
toolServers,
|
||||||
terminalServers,
|
terminalServers,
|
||||||
user as _user,
|
user as _user,
|
||||||
showControls,
|
showControls,
|
||||||
showSettings,
|
showSettings,
|
||||||
selectedTerminalId,
|
showFileNavDir,
|
||||||
TTSWorker,
|
selectedTerminalId,
|
||||||
temporaryChatEnabled
|
TTSWorker,
|
||||||
|
temporaryChatEnabled
|
||||||
} from '$lib/stores';
|
} from '$lib/stores';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -942,11 +943,12 @@
|
|||||||
fileItem.status = 'uploaded';
|
fileItem.status = 'uploaded';
|
||||||
fileItem.id = uploadedFile.path;
|
fileItem.id = uploadedFile.path;
|
||||||
fileItem.path = uploadedFile.path;
|
fileItem.path = uploadedFile.path;
|
||||||
fileItem.url = uploadedFile.path;
|
fileItem.url = uploadedFile.path;
|
||||||
fileItem.size = uploadedFile.size ?? file.size;
|
fileItem.size = uploadedFile.size ?? file.size;
|
||||||
fileItem.file = uploadedFile;
|
fileItem.file = uploadedFile;
|
||||||
files = files;
|
files = files;
|
||||||
} else {
|
showFileNavDir.set(uploadedFile.path);
|
||||||
|
} else {
|
||||||
fileItem.status = 'error';
|
fileItem.status = 'error';
|
||||||
fileItem.error = $i18n.t('Failed to upload file.');
|
fileItem.error = $i18n.t('Failed to upload file.');
|
||||||
toast.error(fileItem.error);
|
toast.error(fileItem.error);
|
||||||
|
|||||||
Reference in new issue
Block a user