ignoring JSONAPI routes based on route name matching is brittle

Created on 6 September 2023, over 1 year ago
Updated 23 April 2024, 8 months ago

Problem/Motivation

    // Ignore route for jsonapi calls.
    if (strpos($route_name, 'jsonapi') !== FALSE) {

This is brittle and could have false positives for any route such as an admin UI page for a jsonapi-related module.

It would be better to detect the route format instead.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joachim
  • Status changed to Postponed: needs info 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    Thanks for reporting this issue. I see you tested on 4.0.x but that 1.5 years ago so it would be good to test on the latest dev branch.

    I'm going through all the 8.x issues.

    As the 8.x is no longer supported, I'm postponing this issue for now and need feedback as to whether or not this issue is relevant to 4.0.x.

    If it is, please reopen and change the version, and make sure the issue summary is clear and complete, including steps to reproduce. If it's not, please close.

    If there is no response to this in a month addressing the above, it can be closed.

  • πŸ‡§πŸ‡·Brazil larruda

    $route_name is NULL on many different occasions. This message has been appearing frequently for me.

  • Status changed to Active 8 months ago
  • πŸ‡¬πŸ‡§United Kingdom joachim

    93-
    94: // Ignore route for jsonapi calls.
    95- if (strpos($route_name, 'jsonapi') !== FALSE) {
    96- return;
    97- }
    98-

    It's still in 4.0.x.

  • Status changed to Needs review 8 months ago
  • Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 7.4 & MySQL 5.7
    last update 8 months ago
    Waiting for branch to pass
  • πŸ‡§πŸ‡·Brazil larruda

    Created a patch.
    Haven't fully tested it yet though.

Production build 0.71.5 2024