From 3f394ca96db048313c809aee930d0aa0eefef412 Mon Sep 17 00:00:00 2001 From: duvld Date: Thu, 4 Jun 2020 15:50:54 -0400 Subject: [PATCH 1/2] Applied title fix to dropped files --- jsapp/js/components/modalForms/projectSettings.es6 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jsapp/js/components/modalForms/projectSettings.es6 b/jsapp/js/components/modalForms/projectSettings.es6 index 948d3b9128..795bf0856f 100644 --- a/jsapp/js/components/modalForms/projectSettings.es6 +++ b/jsapp/js/components/modalForms/projectSettings.es6 @@ -550,10 +550,15 @@ class ProjectSettings extends React.Component { // when replacing, we omit PROJECT_DETAILS step this.goToFormLanding(); } else { - // try proposing something more meaningful than "Untitled" + // TODO: allow serializers to take care of file names to + // remove this bandaid fix for "Untitled" filenames + var assetName = finalAsset.name; + if (assetName === 'Untitled') { + assetName = files[0].name.split('.xlsx')[0]; + } this.setState({ formAsset: finalAsset, - name: finalAsset.name, + name: assetName, description: finalAsset.settings.description, sector: finalAsset.settings.sector, country: finalAsset.settings.country, From f0db87a3ac7b9e94a9be9110cc7789cb12244a74 Mon Sep 17 00:00:00 2001 From: duvld Date: Thu, 4 Jun 2020 15:58:27 -0400 Subject: [PATCH 2/2] Added title fix to url imports --- jsapp/js/components/modalForms/projectSettings.es6 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/jsapp/js/components/modalForms/projectSettings.es6 b/jsapp/js/components/modalForms/projectSettings.es6 index 795bf0856f..c3c63cd47d 100644 --- a/jsapp/js/components/modalForms/projectSettings.es6 +++ b/jsapp/js/components/modalForms/projectSettings.es6 @@ -152,6 +152,10 @@ class ProjectSettings extends React.Component { } } + getFilenameFromURI(url) { + return decodeURIComponent(new URL(url).pathname.split('/').pop().split('.')[0]); + } + /* * handling user input */ @@ -492,10 +496,15 @@ class ProjectSettings extends React.Component { // when replacing, we omit PROJECT_DETAILS step this.goToFormLanding(); } else { + // TODO: allow serializers to take care of file names to + // remove this bandaid fix for "Untitled" filenames + var assetName = finalAsset.name; + if (assetName === 'Untitled') { + assetName = this.getFilenameFromURI(importUrl); + } this.setState({ formAsset: finalAsset, - // try proposing something more meaningful than "Untitled" - name: finalAsset.name, + name: assetName, description: finalAsset.settings.description, sector: finalAsset.settings.sector, country: finalAsset.settings.country,