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

Add URL normalizePath() filter #3237

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Commits on Sep 19, 2024

  1. Add normalizePath filter

    Adds a filter called `normalizePath` which implements URL Path
    normalization by removing empty path segments and trailing slashes from
    the path. This follows the guidance from the Zalando Restful API
    Guidelines rule [136][1].
    
    [1]: https://opensource.zalando.com/restful-api-guidelines/#136
    
    Signed-off-by: Mikko Valkonen <[email protected]>
    mvalkon committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    fb03a7b View commit details
    Browse the repository at this point in the history
  2. Handle the path normalization manually

    path.Clean() may break certain edge-cases where the path-variables
    would use `.` or `..` characters. This commit removes the usage of
    path.Clean() and implements the normalization manually.
    
    Signed-off-by: Mikko Valkonen <[email protected]>
    mvalkon committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    deb82fb View commit details
    Browse the repository at this point in the history
  3. Simplify the implementation

    Removes some dead code and adds test to cover for root path segment.
    
    Signed-off-by: Mikko Valkonen <[email protected]>
    mvalkon committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    6c4fa26 View commit details
    Browse the repository at this point in the history
  4. Add documentation for the normalizePath()-filter

    Adds rudimentary documentation for the normalizePath()-filter with
    examples.
    
    Signed-off-by: Mikko Valkonen <[email protected]>
    mvalkon committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    a3b6765 View commit details
    Browse the repository at this point in the history