Partial words are being matched

Created on 11 November 2024, 4 months ago

Problem/Motivation

Matches for words in our Glossary taxonomy are being picked up for partial words as illustrated below where 'ALU' is being matched in the the word 'values'.

Later is it again matched inside the word 'really'!

🐛 Bug report
Status

Active

Version

4.1

Component

Code

Created by

🇬🇧United Kingdom SirClickALot Somerset

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

Merge Requests

Comments & Activities

  • Issue created by @SirClickALot
  • 🇫🇷France mably

    Looks like current implementation doesn't try to match full words only.

  • Assigned to mably
  • 🇫🇷France mably

    Looks like a simple regular expression to update. Will work on a fix.

  • 🇫🇷France mably

    New full-word configuration option added to the global settings form:

    • mably committed 357ea6b6 on 4.1.x
      Issue #3486637 by mably: Partial words are being matched
      
  • 🇫🇷France mably

    @sirclickalot it should be fixed in release 4.1.0-rc2 .

    Could you give it a try?

  • 🇬🇧United Kingdom SirClickALot Somerset

    Hi @mably,

    We have tried the update module and yes, this seems to have fixed both the partial-word blocking feature request and the once-only one.

    Nic work.

    We have however noticed some other behaviour...

    Anonymous and UID:1

    For both the Anonymous user and UID:1 there is NO POPUP at all when clicking a highlighted anchor...

    We thought at first that this might be something to do with Taxonomy permissions — we also use Taxonomy Access Fix to enable all roles to view Vocabulary names — but it does not appear to be to do with that.

    Logged in users

    For a logged in (less powerful) user, we do get one, and it all seems to work (albeit after a fairly long delay) to populate the pop-up...

  • 🇫🇷France mably

    Just made a test with the anonymous user (private browser, no connection) and it works fine on my side:

    Is your taxonomy accessible to the anonymous user?

  • 🇬🇧United Kingdom SirClickALot Somerset

    No JavaScript error in the Console, that was the place we looked.

    Taxonomy definitely open to the Anonymous users: https://bit-by-bit.org/glossary

  • 🇫🇷France mably

    Can you see the Ajax call log in the network tab?

    If yes, what is the response content of the Ajax call?

    Is a test URL available so I could check the problem by myself?

  • 🇬🇧United Kingdom SirClickALot Somerset

    OK, a bit more feedback but I accept that the lack of a pop-ups at all for UID:1 and the endless AJAX for the Anonymous user is probably not the fault of this module.

    The URL I provided was merely to show that the Anonymous does indeed have access to the Glossary taxonomy terms.

    We are only testing the module locally so we're afraid we can't supply a real live test URL for you but all this should help to make things clearer...

    UID:1 user

    No pop-up at all.

    When clicking the anchor in the text and inspecting the Network tab we a see...

    When we visit the same URL directly in the browser we see...

    // Status 200 (dns:0ms,tcp:0ms,req:1155.7000000029802ms,res:0.6999999955296516ms)
    {
      "name": "Data",
      "tid": "4379",
      "description": "\u003Cp\u003E\u003Cstrong\u003EData \u003C\/strong\u003Econsists of \u003Cstrong\u003Eraw\u003C\/strong\u003E, \u003Cstrong\u003Eunprocessed \u003C\/strong\u003Efacts, while information is data that has been organized and given meaning.\u003C\/p\u003E"
    }
    

    Which all seems in order.

    Anonymous user

    As in the previous posts, when the Anonymous user clicks an anchor, they get a pop-up but they see a continuous AJAX throbber and the Network Inspector tab shows...

    Something is trying to redirect access to that ULR?

    This is then followed by...

    I'm not sure quite what creates that URL - core or something else? But whatever, the Anonymous user cannot get there and seems to be being redirected - very odd since that can easily visit the 'normal' /taxonomy/term/4376 URL.

    As far as we are aware, we do not have modules that perform redirects on 403 - we DID but they've all long gone in this testing and we've cleared every conceivable cache culprit.

    Anyway, I thought this might all be useful to someone even if it doesn't necessarily point to any bug in this module.

  • 🇫🇷France mably

    Thanks a lot for your feedback @sirclickalot.

    Looks like it's redirecting to the login page, so it seems the anonymous user doesn't have access to the Ajax URL... 🤔

    Here is an excerpt of the routing.yml file:

    term_glossary.glossary_controller_get_term_by_id:
      path: '/glossary-get-term-by-id/{tid}'
      defaults:
        _controller: '\Drupal\term_glossary\Controller\TermGlossaryController::apiGetTermById'
      requirements:
        _permission: 'access content'
    

    Does the anonymous user have the access content permission?

  • 🇬🇧United Kingdom SirClickALot Somerset

    They certainly do otherwise you wouldn't be able to see all these goodies...
    https://bit-by-bit.org/tutorials/primitive-logic-gates

  • 🇫🇷France mably

    The mystery deepens... 😉

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

Production build 0.71.5 2024