Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ import { connect } from "react-redux";
import history from "../../../../../../history";
import { decodeFileName, encodeFileName } from "../../../../../../common/utils";
import { setModalErrorSnackMessage } from "../../../../../../actions";
import { BucketObject } from "./types";
import { BucketObjectItem } from "./types";
import { CreateNewPathIcon } from "../../../../../../icons";

interface ICreateFolder {
classes: any;
modalOpen: boolean;
bucketName: string;
folderName: string;
setModalErrorSnackMessage: typeof setModalErrorSnackMessage;
onClose: () => any;
existingFiles: BucketObject[];
existingFiles: BucketObjectItem[];
setModalErrorSnackMessage: typeof setModalErrorSnackMessage;
}

const styles = (theme: Theme) =>
Expand Down Expand Up @@ -74,8 +74,9 @@ const CreateFolderModal = ({
? decodedFolderName
: `${decodedFolderName}/`;
}
const sharesName = (record: BucketObject) =>
const sharesName = (record: BucketObjectItem) =>
record.name === folderPath + pathUrl;

if (existingFiles.findIndex(sharesName) !== -1) {
setModalErrorSnackMessage({
errorMessage: "Folder cannot have the same name as an existing file",
Expand All @@ -84,8 +85,8 @@ const CreateFolderModal = ({
return;
}
const newPath = `/buckets/${bucketName}/browse/${encodeFileName(
`${folderPath}${pathUrl}`
)}/`;
`${folderPath}${pathUrl}/`
)}`;
history.push(newPath);
onClose();
};
Expand Down
Loading