Problem/Motivation

On the REST resources page of the module the path is shown in code Tags - due to double escaping of markup in the table these tags are printed out.

Proposed resolution

Use inline_template to print out text with markup in the table row.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SteffenR’s picture

I attached a patch solving this issue.

SteffenR’s picture

Status: Active » Needs review
clemens.tolboom’s picture

Status: Needs review » Needs work
+++ b/src/Controller/RestUIController.php
@@ -147,7 +147,10 @@ class RestUIController implements ContainerInjectionInterface {
+						'path' =>  array('data' => array(
+							'#type' => 'inline_template',
+							'#template' => $uri_paths,
+						)),
             'description' => array(),

White space problems (tabs?)

I'm not sure the #type / #template is the correct way. I do understand the way but expected either 'html' for #type or another key for $uri_paths.

What do you think? Do you have link to this templating to learn from?

SteffenR’s picture

I fixed the patch and solved the whitespace issues (was caused by misconfigured tab settings in textmate).
Regarding the templating via #type - just have a look in the BlockController.php (line 80) of core - that's the same "usecase", cause $uri_parts also contains HTML.

SteffenR

SteffenR’s picture

Status: Needs work » Needs review
clemens.tolboom’s picture

Status: Needs review » Needs work

@SteffenR thanks but I get

Content 	//node/{node}

which was obviously overlooked. Can you have a look why some path get double // ? Is this only for content entities?

SteffenR’s picture

Status: Needs work » Needs review
FileSize
45.26 KB

@clemens.tolboom: oh this "bug" is new to me - i just checked out the latest d8 release to reproduce it.
The bug comes from ResourcePluginManager - it returns the canonical url in the getDefinitions method with double slashes.

Attached a screenshot showing the issue:

I also created a new bug ticket for this issue https://www.drupal.org/node/2409789

SteffenR

clemens.tolboom’s picture

Thanks for the debugging and conclude into #2409789: Double slashes in canonicals while calling resourcePluginManager->getDefinitions()

I myself did some debugging failed to the why. The $definition key == 'entity:node === id which is in code split into /entity/entity_type so should lead to /entity/node ... somehow I guess a listener mingles the canonical path.

I guess your patch has nothing to do with this bug. Hope to process it shortly.

clemens.tolboom’s picture

Status: Needs review » Fixed

Thanks @SteffenR

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.