File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
web-app/src/screens/Console/Buckets/ListBuckets/Objects Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 15
15
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
17
17
import { BucketObjectItem } from "./ListObjects/types" ;
18
- import { encodeURLString } from "../../../../../common/utils" ;
18
+ import { decodeURLString , encodeURLString } from "../../../../../common/utils" ;
19
19
import { removeTrace } from "../../../ObjectBrowser/transferManager" ;
20
20
import store from "../../../../../store" ;
21
21
import { ContentType , PermissionResource } from "api/consoleApi" ;
@@ -64,6 +64,11 @@ export const downloadSelectedAsZip = async (
64
64
) ;
65
65
}
66
66
} ;
67
+
68
+ const isFolder = ( objectPath : string ) => {
69
+ return decodeURLString ( objectPath ) . endsWith ( "/" ) ;
70
+ } ;
71
+
67
72
export const download = (
68
73
bucketName : string ,
69
74
objectPath : string ,
@@ -116,7 +121,9 @@ export const download = (
116
121
req . responseType = "blob" ;
117
122
req . onreadystatechange = ( ) => {
118
123
if ( req . readyState === XMLHttpRequest . DONE ) {
119
- let completeDownload = req . response . size === fileSize ;
124
+ // Ensure object was downloaded fully, if it's a folder we don't get the fileSize
125
+ let completeDownload =
126
+ isFolder ( objectPath ) || req . response . size === fileSize ;
120
127
121
128
if ( req . status === StatusCodes . OK && completeDownload ) {
122
129
const rspHeader = req . getResponseHeader ( "Content-Disposition" ) ;
You can’t perform that action at this time.
0 commit comments