Fix drive letters

This commit is contained in:
momo5502
2025-09-28 10:48:09 +02:00
parent ac5adf08d2
commit 7f8716b648

View File

@@ -307,6 +307,17 @@ export class FilesystemExplorer extends React.Component<
}
async _onFileRename(file: string, newFile: string) {
newFile = newFile.toLowerCase();
if (newFile == file) {
this.setState({ renameFile: "" });
return;
}
if (!this._validateName(newFile)) {
return;
}
const oldPath = makeFullPathWithState(this.state, file);
const newPath = makeFullPathWithState(this.state, newFile);
@@ -324,25 +335,33 @@ export class FilesystemExplorer extends React.Component<
await this._uploadFiles(files);
}
async _onFolderCreate(name: string) {
this.setState({ createFolder: false });
name = name.toLowerCase();
_validateName(name: string) {
if (name.length == 0) {
return;
return false;
}
if (name.includes("/") || name.includes("\\")) {
this._showError("Folder must not contain special characters");
return;
return false;
}
if (this.state.path.length == 0 && name.length > 1) {
this._showError("Drives must be a single letter");
return false;
}
return true;
}
async _onFolderCreate(name: string) {
name = name.toLowerCase();
if (!this._validateName(name)) {
return;
}
this.setState({ createFolder: false });
const fullPath = makeFullPathWithState(this.state, name);
await this.props.filesystem.createFolder(fullPath);
this.forceUpdate();