Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseInternalLinks corrections for double digit ids #2338

Merged
merged 5 commits into from
Jan 24, 2024
Merged

Conversation

avinash403
Copy link
Contributor

@avinash403 avinash403 commented Sep 17, 2023

Description

Issue 1: While rendering a linked browserModule using $block->wysiwyg('field'), the logic picks only single digit of the id. For eg.
if this is the href of a link #twillInternalLink::App\Models\Category#23, the current logic will only pick 2 as id instead of 23

Issue 2: the current logic only query for published records. It doesn't handle a scenario when a linked published record gets unpublished.

Issue 3: Regex /(#twillInternalLink::(.*)#(\d+))/ breaks when there are multiple links in a block. It catches the first and the last "#"

This PR handles both the scenarios by
fix 1. correcting the regex
fix 2. adding a 404 when the model is not found
fix 3. changed regex to pick the shortest matching string which makes the model search end as the first "#"

@CLAassistant
Copy link

CLAassistant commented Sep 17, 2023

CLA assistant check
All committers have signed the CLA.

@ifox ifox merged commit 57d6093 into area17:3.x Jan 24, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants