Problem/Motivation

When the endpoint has a slash at the end, we are having issues requesting sections because of the double slash.

Steps to reproduce

When saving an entity related to Applenews, the document can't be sent to Applenews because the request is incorrect.

Proposed resolution

Remove the extra slash

Issue fork applenews-3191123

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

BetoAveiga created an issue. See original summary.

betoaveiga’s picture

m4olivei’s picture

Assigned: Unassigned » m4olivei

Taking a look at this. Lets see if we can write a test for this. Also it would be good to ensure consistency for the endpoint value, wether that's in the UI, or if we just make the code that puts together these section URLs more robust.

m4olivei’s picture

Status: Active » Needs work

m4olivei’s picture

Assigned: m4olivei » Unassigned
Status: Needs work » Needs review

I did both things I mentioned:

  • Tightened up the settings form to both enforce a URL using the url field type, and trim any trailing slash submitted for consistency
  • Used \GuzzleHttp\Psr7\Uri to compose the section URL's to make that piece more robust

I also added additional tests for the settings form. I would have liked some tests for \Drupal\applenews\ApplenewsManager as well, but that class is a bit of a bear ATM and could use some refactoring to make it test friendly. A task for another day.

  • m4olivei committed c857265 on 8.x-1.x
    Issue #3191123 by m4olivei, BetoAveiga: Remove slash on sections...
m4olivei’s picture

Status: Needs review » Fixed

Went ahead and merged it. Feel free to re-open / create a new issue if necessary.

Status: Fixed » Closed (fixed)

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