Merge pull request #822 from lbryio/revert-820-fourohfour2

Revert "Sets proper 404 status in most cases"
This commit is contained in:
jessopb 2018-12-14 17:43:50 -05:00 committed by GitHub
commit bf2a52ba67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,11 +20,11 @@ const createCanonicalLink = require('../../../utils/createCanonicalLink');
const getCanonicalUrlFromShow = show => { const getCanonicalUrlFromShow = show => {
const requestId = show.requestList[show.request.id]; const requestId = show.requestList[show.request.id];
const requestType = show.request.type; const requestType = show.request.type;
if (!requestId || !requestType) { if (!requestId || !requestType) {
return null; return null;
} }
switch (requestType) { switch (requestType) {
case 'ASSET_DETAILS': case 'ASSET_DETAILS':
const asset = show.assetList[requestId.key]; const asset = show.assetList[requestId.key];
@ -57,15 +57,16 @@ module.exports = (req, res) => {
// Workaround, remove when a solution for async httpContext exists // Workaround, remove when a solution for async httpContext exists
const showState = store.getState().show; const showState = store.getState().show;
const assetKeys = Object.keys(showState.assetList); const assetKeys = Object.keys(showState.assetList);
const channelKeys = Object.keys(showState.channelList);
if(assetKeys.length !== 0) {
if (assetKeys.length !== 0) {
res.claimId = showState.assetList[assetKeys[0]].claimId; res.claimId = showState.assetList[assetKeys[0]].claimId;
} else if (channelKeys.length !== 0) {
res.claimId = showState.channelList[channelKeys[0]].longId;
res.isChannel = true;
} else { } else {
res.status(404); const channelKeys = Object.keys(showState.channelList);
if(channelKeys.length !== 0) {
res.claimId = showState.channelList[channelKeys[0]].longId;
res.isChannel = true;
}
} }
// render component to a string // render component to a string