From 880b890dc29104d3a5774b280345f6ff24591d6a Mon Sep 17 00:00:00 2001 From: chrisgarrity Date: Tue, 4 Dec 2018 10:48:16 -0500 Subject: [PATCH] Show NotAvailable for invalid URL `/projects` without an id or `editor` should just show a 404. --- src/views/preview/project-view.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/views/preview/project-view.jsx b/src/views/preview/project-view.jsx index 58502e0dc..e933bef90 100644 --- a/src/views/preview/project-view.jsx +++ b/src/views/preview/project-view.jsx @@ -69,7 +69,7 @@ class Preview extends React.Component { const pathname = window.location.pathname.toLowerCase(); const parts = pathname.split('/').filter(Boolean); // parts[0]: 'projects' - // parts[1]: either :id or 'editor' + // parts[1]: either :id or 'editor', invalid if neither specified // parts[2]: undefined if no :id, otherwise either 'editor' or 'fullscreen' // Get single-comment id from url hash, using the #comments-{id} scheme from scratch2 @@ -81,6 +81,7 @@ class Preview extends React.Component { addToStudioOpen: false, extensions: [], favoriteCount: 0, + invalidProject: parts.length === 1, justShared: false, loveCount: 0, modInfo: { @@ -448,7 +449,7 @@ class Preview extends React.Component { ); } render () { - if (this.props.projectNotAvailable) { + if (this.props.projectNotAvailable || this.state.invalidProject) { return (