Validate paths like core does

Created on 5 April 2024, 3 months ago

Problem/Motivation

Path validation isn't very well and standardized currently. We should do this like core does in https://api.drupal.org/api/drupal/core%21modules%21system%21src%21Form%2...

for example for

  • site_frontpage
  • site_403
  • site_404
  • ...

which should include

  • Dependency injection for PathValidatorInterface
  • Implementing form validation

Would be great, if someone could prepare a MR!

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs review

Version

10.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Anybody
  • Assigned to nidhi27
  • Merge request !14Added path validations. → (Open) created by nidhi27
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • 🇮🇳India nidhi27

    Hi,

    I have created #MR14 with the path validations. I have checked the functionality. Its working as expected. Let me know if anything else needs to be add here.

    Thanks!

  • Pipeline finished with Success
    3 months ago
    Total: 191s
    #138840
  • 🇩🇪Germany Anybody Porta Westfalica

    @nidhi27 looking great!

    I left some comments. What about edge-cases? Is there anything we need to think about for URLs, like external URLs or anchor links (#)? Does that make sense for such cases?
    External links don't make sense, I think? And Anchors?
    Anything else?

    Could you also add tests for the new functionality perhaps? And if it's possible and you have the time and coding fun, perhaps general tests in 📌 Write tests Active ?

  • Pipeline finished with Success
    3 months ago
    Total: 137s
    #138879
  • 🇮🇳India nidhi27

    Hi @Anybody,

    Other than this, links can have query parameters. This is also getting verified here with anchor links(#).
    I dont think external links is making sense here. Mostly front pages are inner pages and thats why we are checking it with "/" and if the url exist in drupal or not.

    I think we can add all the test cases in https://www.drupal.org/project/front/issues/3438834 📌 Write tests Active to avoid any code conflicts.

  • Assigned to Grevil
  • 🇩🇪Germany Anybody Porta Westfalica

    Yes I agree, please prepare the tests and I'll pass this for review to Mr. clean code @Grevil :)

Production build 0.69.0 2024