@@ -152,6 +152,10 @@ class ProjectSettings extends React.Component {
152152 }
153153 }
154154
155+ getFilenameFromURI ( url ) {
156+ return decodeURIComponent ( new URL ( url ) . pathname . split ( '/' ) . pop ( ) . split ( '.' ) [ 0 ] ) ;
157+ }
158+
155159 /*
156160 * handling user input
157161 */
@@ -492,10 +496,15 @@ class ProjectSettings extends React.Component {
492496 // when replacing, we omit PROJECT_DETAILS step
493497 this . goToFormLanding ( ) ;
494498 } else {
499+ // TODO: allow serializers to take care of file names to
500+ // remove this bandaid fix for "Untitled" filenames
501+ var assetName = finalAsset . name ;
502+ if ( assetName === 'Untitled' ) {
503+ assetName = this . getFilenameFromURI ( importUrl ) ;
504+ }
495505 this . setState ( {
496506 formAsset : finalAsset ,
497- // try proposing something more meaningful than "Untitled"
498- name : finalAsset . name ,
507+ name : assetName ,
499508 description : finalAsset . settings . description ,
500509 sector : finalAsset . settings . sector ,
501510 country : finalAsset . settings . country ,
@@ -550,10 +559,15 @@ class ProjectSettings extends React.Component {
550559 // when replacing, we omit PROJECT_DETAILS step
551560 this . goToFormLanding ( ) ;
552561 } else {
553- // try proposing something more meaningful than "Untitled"
562+ // TODO: allow serializers to take care of file names to
563+ // remove this bandaid fix for "Untitled" filenames
564+ var assetName = finalAsset . name ;
565+ if ( assetName === 'Untitled' ) {
566+ assetName = files [ 0 ] . name . split ( '.xlsx' ) [ 0 ] ;
567+ }
554568 this . setState ( {
555569 formAsset : finalAsset ,
556- name : finalAsset . name ,
570+ name : assetName ,
557571 description : finalAsset . settings . description ,
558572 sector : finalAsset . settings . sector ,
559573 country : finalAsset . settings . country ,
0 commit comments