Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Bug] Fixed dropbox upload in Firefox. Passing explicit file name to upload function

Giuseppe Macrì33c785f90ad1
diff --git a/examples/demo-app/src/actions.js b/examples/demo-app/src/actions.js
index c31de993f..7922af03d 100644
--- a/examples/demo-app/src/actions.js
+++ b/examples/demo-app/src/actions.js
@@ -359,10 +359,11 @@ export function exportFileToCloud(handlerName = 'dropbox') {
// extract data from kepler
const data = KeplerGlSchema.save(getState().demo.keplerGl.map);
const newBlob = new Blob([JSON.stringify(data)], {type: 'application/json'});
- const file = new File([newBlob], `/keplergl_${generateHashId(6)}.json`);
+ const fileName = `/keplergl_${generateHashId(6)}.json`;
+ const file = new File([newBlob], fileName);
// We are gonna pass the correct auth token to init the cloud provider
dispatch(setPushingFile(true, {filename: file.name, status: 'uploading', metadata: null}));
- authHandler.uploadFile({blob: file, isPublic: true, authHandler})
+ authHandler.uploadFile({blob: file, name: fileName, isPublic: true, authHandler})
// need to perform share as well
.then(
response => {
diff --git a/examples/demo-app/src/utils/cloud-providers/dropbox.js b/examples/demo-app/src/utils/cloud-providers/dropbox.js
index 4ffbdb346..a45b5f33e 100644
--- a/examples/demo-app/src/utils/cloud-providers/dropbox.js
+++ b/examples/demo-app/src/utils/cloud-providers/dropbox.js
@@ -77,7 +77,7 @@ function getAccessTokenFromLocation(location) {
*/
function uploadFile({blob, name, isPublic = true}) {
const promise = dropbox.filesUpload({
- path: blob.name || name,
+ path: name || blob.name,
contents: blob
});
diff --git a/examples/demo-app/webpack.config.js b/examples/demo-app/webpack.config.js
index a63dbea96..e898e2f25 100644
--- a/examples/demo-app/webpack.config.js
+++ b/examples/demo-app/webpack.config.js
@@ -73,7 +73,8 @@ const CONFIG = {
// Optional: Enables reading mapbox and dropbox client token from environment variable
plugins: [
new webpack.EnvironmentPlugin([
- 'MapboxAccessToken'
+ 'MapboxAccessToken',
+ 'DropboxClientId'
])
]
};