diff --git a/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php b/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php index 7103a1e..2592ece 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php @@ -87,6 +87,7 @@ public function getReply(NodeInterface $node, $pid, Request $request) { drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->label(), 'node/' . $node->id()))); $op = $request->request->get('op'); $build = array(); + $uri = $node->uri(); // The user is previewing a comment prior to submitting it. if ($op == t('Preview')) { @@ -100,7 +101,7 @@ public function getReply(NodeInterface $node, $pid, Request $request) { } else { drupal_set_message(t('You are not authorized to post comments.'), 'error'); - return new RedirectResponse($this->urlGenerator->generateFromPath($node->uri(), array('absolute' => TRUE))); + return new RedirectResponse($this->urlGenerator->generateFromPath($uri['path'], array('absolute' => TRUE))); } } @@ -117,19 +118,19 @@ public function getReply(NodeInterface $node, $pid, Request $request) { if ($comment->nid->target_id != $node->id()) { // Attempting to reply to a comment not belonging to the current nid. drupal_set_message(t('The comment you are replying to does not exist.'), 'error'); - return new RedirectResponse($this->urlGenerator->generateFromPath($node->uri(), array('absolute' => TRUE))); + return new RedirectResponse($this->urlGenerator->generateFromPath($uri['path'], array('absolute' => TRUE))); } // Display the parent comment $build['comment_parent'] = $this->entityManager->getRenderController('comment')->view($comment); } else { drupal_set_message(t('The comment you are replying to does not exist.'), 'error'); - return new RedirectResponse($this->urlGenerator->generateFromPath($node->uri(), array('absolute' => TRUE))); + return new RedirectResponse($this->urlGenerator->generateFromPath($uri['path'], array('absolute' => TRUE))); } } else { drupal_set_message(t('You are not authorized to view comments.'), 'error'); - return new RedirectResponse($this->urlGenerator->generateFromPath($node->uri(), array('absolute' => TRUE))); + return new RedirectResponse($this->urlGenerator->generateFromPath($uri['path'], array('absolute' => TRUE))); } } // This is the case where the comment is in response to a node. Display the node. @@ -140,7 +141,7 @@ public function getReply(NodeInterface $node, $pid, Request $request) { // Should we show the reply box? if ($node->comment != COMMENT_NODE_OPEN) { drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error'); - return new RedirectResponse($this->urlGenerator->generateFromPath($node->uri(), array('absolute' => TRUE))); + return new RedirectResponse($this->urlGenerator->generateFromPath($uri['path'], array('absolute' => TRUE))); } elseif (user_access('post comments')) { $comment = $this->entityManager->getStorageController('comment')->create(array( @@ -152,7 +153,7 @@ public function getReply(NodeInterface $node, $pid, Request $request) { } else { drupal_set_message(t('You are not authorized to post comments.'), 'error'); - return new RedirectResponse($this->urlGenerator->generateFromPath($node->uri(), array('absolute' => TRUE))); + return new RedirectResponse($this->urlGenerator->generateFromPath($uri['path'], array('absolute' => TRUE))); } } return $build;