Skip to content

[APIP] Formatting values (FILTER_SANITIZE_URL) #17728

Merged
GSadee merged 2 commits intoSylius:2.0from
christopherhero:fix/identifier_converter
May 6, 2025
Merged

[APIP] Formatting values (FILTER_SANITIZE_URL) #17728
GSadee merged 2 commits intoSylius:2.0from
christopherhero:fix/identifier_converter

Conversation

@christopherhero
Copy link
Copy Markdown
Member

@christopherhero christopherhero commented Mar 10, 2025

resolves #17727

The problem occurs in all API commands that implement Sylius\Bundle\ApiBundle\Command\IriToIdentifierConversionAwareInterface.

Q A
Branch? 1.13, 1.14 and 2.0
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #17727
License MIT

@christopherhero christopherhero requested a review from a team as a code owner March 10, 2025 19:49
@probot-autolabeler probot-autolabeler bot added Docker Docker-related issues and PRs. Maintenance CI configurations, READMEs, releases, etc. labels Mar 10, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 10, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

@christopherhero christopherhero force-pushed the fix/identifier_converter branch from 30b2e04 to d0ee4e1 Compare March 10, 2025 19:52
@probot-autolabeler probot-autolabeler bot added the API APIs related issues and PRs. label Mar 10, 2025
@christopherhero christopherhero removed Maintenance CI configurations, READMEs, releases, etc. Docker Docker-related issues and PRs. labels Mar 10, 2025
@christopherhero christopherhero requested a review from a team March 11, 2025 10:13
@GSadee GSadee changed the base branch from 1.13 to 1.14 March 11, 2025 11:29
@christopherhero christopherhero force-pushed the fix/identifier_converter branch from 8870a2f to ce59fe5 Compare March 11, 2025 11:44
mpysiak
mpysiak previously approved these changes Mar 11, 2025
@christopherhero christopherhero requested a review from a team March 18, 2025 10:46
Wojdylak
Wojdylak previously approved these changes Mar 25, 2025
return false;
}

$fieldValue = filter_var($fieldValue, FILTER_SANITIZE_URL);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, it will only cleanup field data for IRI conversion and full comment (from example) will go into DB?

Sanitize option doesn't do validation and always will return what have been supplied (int, invalid url strings), but my only concern is support for non-latin paths.

Sanitize the string by remove all characters except latin letters

https://www.php.net/manual/en/filter.constants.php#constant.filter-sanitize-url

Copy link
Copy Markdown
Member Author

@christopherhero christopherhero Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, it will only cleanup field data for IRI conversion and full comment (from example) will go into DB?

yes exactly.

Sanitize option doesn't do validation and always will return what have been supplied (int, invalid url strings), but my only concern is support for non-latin paths.

Could you please give an example of what url's you mean ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diimpp
I added test coverage*

@NoResponseMate
Copy link
Copy Markdown
Contributor

Hi @christopherhero,

Any update regarding this PR?

Cheers 🍻

…ndle\Converter\IriToIdentifierConverter::isIdentifier($fieldValue)`

(fix after ->  symfony/http-foundation@168b77c71)
@christopherhero
Copy link
Copy Markdown
Member Author

christopherhero commented Apr 22, 2025

Hi @christopherhero,

Any update regarding this PR?

Cheers 🍻

Hi, @NoResponseMate
I just added coverage in testing. ;)

@christopherhero christopherhero dismissed stale reviews from Wojdylak and mpysiak via 2ae2a47 April 22, 2025 13:17
@christopherhero christopherhero force-pushed the fix/identifier_converter branch from ce59fe5 to 2ae2a47 Compare April 22, 2025 13:17
@probot-autolabeler probot-autolabeler bot added Docker Docker-related issues and PRs. Maintenance CI configurations, READMEs, releases, etc. labels Apr 22, 2025
@christopherhero christopherhero changed the base branch from 1.14 to 2.0 April 22, 2025 14:48
@christopherhero christopherhero force-pushed the fix/identifier_converter branch from 2ae2a47 to e9e539d Compare April 23, 2025 12:48
@GSadee GSadee merged commit 6077335 into Sylius:2.0 May 6, 2025
27 checks passed
@GSadee
Copy link
Copy Markdown
Member

GSadee commented May 6, 2025

Thank you @christopherhero! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API APIs related issues and PRs. Docker Docker-related issues and PRs. Maintenance CI configurations, READMEs, releases, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[API] Endpoint to add review does not accept newline characters in the body

6 participants