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

With alphanumeric In FURL Alias ​​Character Restriction Method the dot remain in URL #16665

Open
Ruslan-Aleev opened this issue Dec 17, 2024 · 1 comment
Labels
bug The issue in the code or project, which should be addressed.

Comments

@Ruslan-Aleev
Copy link
Collaborator

Bug report

Summary

If the resource name contains a dot, the dot will also remain in the URL when saved. Even if you set alphanumeric in the friendly_alias_restrict_chars system setting.

I'm not sure if the dot refers to the letters, but it doesn't seem like it should.

sef

Environment

MODX 2.8.8 >

@Ruslan-Aleev Ruslan-Aleev added the bug The issue in the code or project, which should be addressed. label Dec 17, 2024
@smg6511
Copy link
Collaborator

smg6511 commented Jan 23, 2025

@opengeek @theboxer - This does raise an interesting question, in the following two cases in filterPathSegment why do we allow the dot and % chars? Strictly-speaking, it doesn't make sense to me - these chars are simply neither alpha nor numeric (and not used to represent an alphanumeric char [i.e., url %-encoded ones would not fit these criteria anyway]).

case 'alphanumeric':
    /* restrict segment to alphanumeric characters only */
    $segment = preg_replace('/[^\.%A-Za-z0-9 _-]/', '', $segment);
    break;
case 'alpha':
    /* restrict segment to alpha characters only */
    $segment = preg_replace('/[^\.%A-Za-z _-]/', '', $segment);
    break;

I can see why the dash, underscore, and space are included as they're all ultimately replaced by the single preferred later word delimiter char.

If it turns out these rules should stay exactly as-is, we should be more clear in the description for friendly_alias_restrict_chars that certain other chars will be preserved/used to construct the final alias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue in the code or project, which should be addressed.
Projects
None yet
Development

No branches or pull requests

2 participants