From 72d8abe06917e634646d94d3eb8f7387d44090c1 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 19 Jan 2019 00:51:25 -0800 Subject: [PATCH] Canonical check --- app/scenes/Document/Document.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/scenes/Document/Document.js b/app/scenes/Document/Document.js index fc4ae0d34..c9c3b46ce 100644 --- a/app/scenes/Document/Document.js +++ b/app/scenes/Document/Document.js @@ -167,10 +167,13 @@ class DocumentScene extends React.Component { } if (!this.revision) { - // Update url to match the current one - this.props.history.replace( - updateDocumentUrl(props.match.url, document.url) + const canonicalUrl = updateDocumentUrl( + props.match.url, + document.url ); + if (this.props.location !== canonicalUrl) { + this.props.history.replace(canonicalUrl); + } } } } else {