Fixed file download in list (#1130)

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>

Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
Alex
2021-10-19 20:57:07 -05:00
committed by GitHub
parent 95f622a597
commit 67082e1b1d
3 changed files with 6 additions and 13 deletions

View File

@@ -623,7 +623,7 @@ const ListObjects = ({
);
}
download(bucketName, object.name, object.version_id);
download(bucketName, encodeFileName(object.name), object.version_id);
};
const openPath = (idElement: string) => {

View File

@@ -356,20 +356,15 @@ const ObjectDetails = ({
setDeleteTagModalOpen(true);
};
const downloadObject = (object: IFileInfo, includeVersion?: boolean) => {
const downloadObject = (object: IFileInfo) => {
if (object.size && parseInt(object.size) > 104857600) {
// If file is bigger than 100MB we show a notification
setSnackBarMessage(
"Download process started, it may take a few moments to complete"
);
}
download(
bucketName,
internalPaths,
object.version_id,
() => {},
includeVersion
);
download(bucketName, internalPaths, object.version_id);
};
const tableActions: ItemActions[] = [
@@ -391,7 +386,7 @@ const ObjectDetails = ({
{
type: "download",
onClick: (item: IFileInfo) => {
downloadObject(item, true);
downloadObject(item);
},
disableButtonFunction: (item: string) => {
const element = versions.find((elm) => elm.version_id === item);

View File

@@ -17,9 +17,7 @@
export const download = (
bucketName: string,
objectPath: string,
versionID: any,
callBack?: (objIdentifier: string) => void,
includeVersionInCallback?: boolean
versionID: any
) => {
const anchor = document.createElement("a");
document.body.appendChild(anchor);