fix: Backslash-Support im File-Explorer für Chat und Benutzerverwaltung
WorkspaceHelper gibt native Pfade zurück, Frontend-Logik unterstützt beide Separatoren. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
1526891cd9
commit
4e2815ebd3
3 files changed
+12
-9
No files matched your search
@@ -73,7 +73,8 @@ function openFileExplorer(opts = {}) {
|
||||
// Zum Verzeichnis der initialFile navigieren, oder Root
|
||||
if (_feState.initialFile) {
|
||||
const filePath = _feState.initialFile;
|
||||
const dir = filePath.includes('/') ? filePath.substring(0, filePath.lastIndexOf('/')) : '';
|
||||
const lastSep = Math.max(filePath.lastIndexOf('/'), filePath.lastIndexOf('\\'));
|
||||
const dir = lastSep >= 0 ? filePath.substring(0, lastSep) : '';
|
||||
feLoadDir(dir);
|
||||
} else {
|
||||
feLoadDir('');
|
||||
@@ -128,7 +129,8 @@ async function feLoadDir(path) {
|
||||
upItem.innerHTML = '<i class="fa fa-folder"></i> ..';
|
||||
upItem.addEventListener('click', () => {
|
||||
_feState.history.push(path);
|
||||
const parent = path.includes('/') ? path.substring(0, path.lastIndexOf('/')) : '';
|
||||
const lastSep = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
|
||||
const parent = lastSep >= 0 ? path.substring(0, lastSep) : '';
|
||||
feLoadDir(parent);
|
||||
});
|
||||
sidebar.appendChild(upItem);
|
||||
@@ -490,7 +492,7 @@ function openFolderBrowser(opts = {}) {
|
||||
mode: 'folder',
|
||||
onSelect: opts.onSelect || null,
|
||||
currentAbsPath: opts.startPath || '/',
|
||||
basePath: (opts.basePath || '').replace(/\/+$/, '') || null,
|
||||
basePath: (opts.basePath || '').replace(/[\\/]+$/, '') || null,
|
||||
history: []
|
||||
};
|
||||
|
||||
@@ -635,7 +637,8 @@ async function fbCreateDir() {
|
||||
return;
|
||||
}
|
||||
|
||||
const absPath = _feState.currentAbsPath.replace(/\/$/, '') + '/' + dirName;
|
||||
const sep = _feState.currentAbsPath.includes('\\') ? '\\' : '/';
|
||||
const absPath = _feState.currentAbsPath.replace(/[\\/]+$/, '') + sep + dirName;
|
||||
|
||||
try {
|
||||
const resp = await fetch(`/api/workspace/browse/mkdir?path=${encodeURIComponent(absPath)}`, { method: 'POST' });
|
||||
@@ -664,7 +667,8 @@ async function feCreateDir() {
|
||||
return;
|
||||
}
|
||||
|
||||
const newPath = _feState.currentPath ? _feState.currentPath + '/' + dirName : dirName;
|
||||
const sep = _feState.currentPath.includes('\\') ? '\\' : '/';
|
||||
const newPath = _feState.currentPath ? _feState.currentPath + sep + dirName : dirName;
|
||||
|
||||
try {
|
||||
const url = _feApiUrl('mkdir', `path=${encodeURIComponent(newPath)}`);
|
||||
|
||||
Reference in new issue
Block a user