Skip to content
Snippets Groups Projects
Commit b1d16b0c authored by Mike's avatar Mike Committed by Valentine Zavgorodnev
Browse files

1058 cannot read property (#1060)

* Protect for invalid accounts compatibility with 16.2 updatess

* Protect for all namespaced user routes for 16.2 updates
parent 5d7c2a35
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ export const routeRegex = {
PostsIndex: /^\/(@[\w\.\d-]+)\/feed\/?$/,
UserProfile1: /^\/(@[\w\.\d-]+)\/?$/,
UserProfile2: /^\/(@[\w\.\d-]+)\/(blog|posts|comments|recommended|transfers|curation-rewards|author-rewards|permissions|created|recent-replies|feed|password|followed|followers|settings)\/?$/,
UserProfile3: /^\/(@[\w\.\d-]+)\/[\w\.\d-]+/,
UserEndPoints: /^(blog|posts|comments|recommended|transfers|curation-rewards|author-rewards|permissions|created|recent-replies|feed|password|followed|followers|settings)$/,
CategoryFilters: /^\/(hot|created|trending|active|promoted)\/?$/ig,
PostNoCategory: /^\/(@[\w\.\d-]+)\/([\w\d-]+)/,
......
......@@ -144,6 +144,14 @@ async function universalRender({ location, initial_state, offchain }) {
onchain = await Apis.instance().db_api.exec('get_state', [url]);
if (Object.getOwnPropertyNames(onchain.accounts).length === 0 && (url.match(routeRegex.UserProfile1) || url.match(routeRegex.UserProfile3))) { // protect for invalid account
return {
title: 'User Not Found - Steemit',
statusCode: 404,
body: renderToString(<NotFound />)
};
}
if (!url.match(routeRegex.PostsIndex) && !url.match(routeRegex.UserProfile1) && !url.match(routeRegex.UserProfile2) && url.match(routeRegex.PostNoCategory)) {
const params = url.substr(2, url.length - 1).split("/");
const content = await Apis.instance().db_api.exec('get_content', [params[0], params[1]]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment