parent
c35df624e3
commit
4ea43df42b
3 changed files with 15 additions and 1 deletions
|
@ -74,6 +74,10 @@ app.get('*', async (req, res) => {
|
||||||
return res.redirect(301, req.url.replace(/([^/:]+)\/([^:/]+)/, '$1:$2')); // test against urlPath, but use req.url to retain parameters
|
return res.redirect(301, req.url.replace(/([^/:]+)\/([^:/]+)/, '$1:$2')); // test against urlPath, but use req.url to retain parameters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (urlPath.endsWith('/') && urlPath.length > 1) {
|
||||||
|
return res.redirect(301, req.url.replace(/\/$/, ''));
|
||||||
|
}
|
||||||
|
|
||||||
if (urlPath.length > 0 && urlPath[0] !== '$') {
|
if (urlPath.length > 0 && urlPath[0] !== '$') {
|
||||||
const { isChannel, streamName, channelName, channelClaimId, streamClaimId } = parseURI(urlPath.replace(/:/g, '#'));
|
const { isChannel, streamName, channelName, channelClaimId, streamClaimId } = parseURI(urlPath.replace(/:/g, '#'));
|
||||||
const claimName = isChannel ? '@' + channelName : streamName;
|
const claimName = isChannel ? '@' + channelName : streamName;
|
||||||
|
|
|
@ -141,7 +141,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
if (onClick) {
|
if (onClick) {
|
||||||
onClick(e);
|
onClick(e);
|
||||||
} else if ((isChannel || title) && !pending) {
|
} else if ((isChannel || title) && !pending) {
|
||||||
history.push(formatLbryUriForWeb(uri));
|
history.push(formatLbryUriForWeb(claim && claim.canonical_url ? claim.canonical_url : uri));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,16 @@ class ShowPage extends React.PureComponent<Props> {
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { isResolvingUri, resolveUri, claim, uri } = this.props;
|
const { isResolvingUri, resolveUri, claim, uri } = this.props;
|
||||||
|
|
||||||
|
// @if TARGET='web'
|
||||||
|
if (claim && claim.canonical_url) {
|
||||||
|
const canonicalUrlPath = '/' + claim.canonical_url.replace(/^lbry:\/\//, '').replace(/#/g, ':');
|
||||||
|
if (canonicalUrlPath !== window.location.pathname) {
|
||||||
|
history.replaceState(history.state, '', canonicalUrlPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// @endif
|
||||||
|
|
||||||
if (!isResolvingUri && uri && claim === undefined) {
|
if (!isResolvingUri && uri && claim === undefined) {
|
||||||
resolveUri(uri);
|
resolveUri(uri);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue