From e4756b15dbe4d09de9c2bebad37e421cf0247f1d Mon Sep 17 00:00:00 2001 From: Karishma Chadha <kchadha@scratch.mit.edu> Date: Thu, 22 Feb 2018 21:49:30 -0500 Subject: [PATCH] Making import modal input field more permissive. --- src/containers/import-modal.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/containers/import-modal.jsx b/src/containers/import-modal.jsx index 169378e1a..e3112da07 100644 --- a/src/containers/import-modal.jsx +++ b/src/containers/import-modal.jsx @@ -50,9 +50,13 @@ class ImportModal extends React.Component { this.setState({inputValue: e.target.value}); } validate (input) { - const matches = input.match(/^(https:\/\/)?scratch\.mit\.edu\/projects\/(\d+)(\/?)$/); - if (matches && matches.length > 0) { - return matches[2]; + const urlMatches = input.match(/^(https:\/\/)?scratch\.mit\.edu\/projects\/(\d+)(\/?|(\/#editor)?)$/); + if (urlMatches && urlMatches.length > 0) { + return urlMatches[2]; + } + const projectIdMatches = input.match(/^(#?)(\d+)$/); + if (projectIdMatches && projectIdMatches.length > 0) { + return projectIdMatches[2]; } return null; } -- GitLab