Skip to content

[Webhook] WebhookController doesn't accept / character in the webhook path #50973

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

Closed
BOB41K1987 opened this issue Jul 14, 2023 · 0 comments
Closed

Comments

@BOB41K1987
Copy link

Symfony version(s) affected

6.3.0

Description

Webhook routing with a / character in the path doesn't work. This is due to the Symfony router by default doesn't allow a / character in a route parameter

// config/webhook.php
<?php
declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework): void {
    $webhookConfig = $framework
        ->webhook();

    $webhookConfig->routing('some-service/orders') // <-- notice `/` in the path
        ->service(SomeServiceOrderWebhookRequestParser::class)
        ->secret('some-secret');
};

How to reproduce

Install a new symfony/webhook component
Add a new webhook config with a / character in the route
The route won't match and return 404

Possible Solution

Apply the solution from the routing documentation when configuring WebhookController class

Additional Context

No response

@BOB41K1987 BOB41K1987 added the Bug label Jul 14, 2023
nicolas-grekas added a commit that referenced this issue Jul 26, 2023
This PR was merged into the 6.3 branch.

Discussion
----------

[Webhook] Allow slash in webhook type

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #50973 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Allow `/` in webhook type.

This allow to have route like`/webhook/foo/bar`

Commits
-------

d2ae524 [Webhook] Allow slash in webhook type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants