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:
@@ -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) => {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user