FriendsOfSymfony / FOSCommentBundle

Threaded comments for Symfony
http://friendsofsymfony.github.com/
MIT License
462 stars 230 forks source link

URL Validator should not be runned against decoded permalink #638

Closed nreynis closed 6 years ago

nreynis commented 6 years ago

When creating a new thread the permalink URL is decoded before being stored:

ThreadController->getThreadCommentsAction

// Decode the permalink for cleaner storage (it is encoded on the client side)
$permalink = urldecode($request->query->get('permalink'));

The problem is that after decoding it, the URLValidator is runned. The validator will then fail because the URL contains special characters which should have been encoded:

ThreadController->getThreadCommentsAction

if ($validator instanceof ValidatorInterface) {
    $errors = $validator->validate($thread, null, array('NewThread'));
} else {
    $errors = $validator->validate($thread, array('NewThread'));
}
XWB commented 6 years ago

Fixed in https://github.com/FriendsOfSymfony/FOSCommentBundle/pull/646