quickapps / cms

Modular CMS powered by CakePHP
GNU General Public License v3.0
164 stars 69 forks source link

Defining content_extension as '/' breaks content find() #163

Closed quickapps closed 7 years ago

quickapps commented 7 years ago

From @paulrwest on September 8, 2016 11:1

To reproduce define the extension in bootstrap file:

define('CONTENT_EXTENSION', '/');

results in:

The requested address '/article/hello-world/' was not found on this server.

Manually removing the last forward-slash from the URL corrects the issue. Debugging the Serve->details() shows $contentSlug still has the / in it:

2016-09-08 10:42:21 Debug: Content\Controller\ServeController::details() - ROOT\vendor\quickapps-plugins\content\src\Controller\ServeController.php, line 108 Cake\Controller\Controller::invokeAction() - CORE\src\Controller\Controller.php, line 435 Cake\Http\ActionDispatcher::_invoke() - CORE\src\Http\ActionDispatcher.php, line 122 Cake\Http\ActionDispatcher::dispatch() - CORE\src\Http\ActionDispatcher.php, line 96 Cake\Routing\Dispatcher::dispatch() - CORE\src\Routing\Dispatcher.php, line 60 [main] - ROOT\webroot\index.php, line 36 'hello-world/'

Fix: in ../vendor/quickapps-plugins/content/config/routes.php:49

your latest pull of quickapps/website has:

'content_slug' => '.+',

previous version had:

'content_slug' => '[a-z0-9\-]+',

switching the regex back to this fixes the issue for me I'm not sure why you changed it to '.+'.

Copied from original issue: quickapps/website#5

quickapps commented 7 years ago

From @ChristopherCastro on September 10, 2016 10:55

Interesting,

but we should treat this case carefully, as changing the regex pattern could break compatibility with special characters and other languages. That is why we now use .+ instead of [a-z0-9\-]+.

But for what I see, more than a QACMS issue looks more like a Cake's issue and how it uses the / symbol when defining router connectors.

I'll take a look and see how to solve this

best regards!