Don't crash in node

This commit is contained in:
Thomas Weber committed 2021-04-03 14:21:43 -05:00
1 parent 51eb5c87cd
commit c59dfa446f
1 file changed
+5 -3
+5 -3
View File
@@ -79,9 +79,11 @@ const ProjectFetcherHOC = function (WrappedComponent) {
this.props.vm.stop();
let assetPromise;
const urlParams = new URLSearchParams(location.search);
if (urlParams.has('project_url')) {
let projectUrl = urlParams.get('project_url');
// In case running in node...
let projectUrl = typeof URLSearchParams === 'undefined' ?
null :
new URLSearchParams(location.search).get('project_url');
if (projectUrl) {
if (!projectUrl.startsWith('http:') && !projectUrl.startsWith('https:')) {
projectUrl = `https://${projectUrl}`;
}