Skip to content

Commit

Permalink
Merge pull request PrestaShop#30608 from nicosomb/merge-178-80
Browse files Browse the repository at this point in the history
Merge 1.7.8.x into 8.0.x
  • Loading branch information
matks authored Dec 20, 2022
2 parents a155bf9 + b5b51dd commit b710c70
Show file tree
Hide file tree
Showing 11 changed files with 12,902 additions and 12,748 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ GitHub contributors:
- Jan Sýkora
- janisVincent
- Jaume
- Javier García
- Javsmile
- JBWModules
- JEAN
Expand Down Expand Up @@ -533,6 +534,7 @@ GitHub contributors:
- Maxime - Vaisonet
- Maxime Aknin
- Maxime Biloé
- Maxime Flasquin
- Maxime Morel-Bailly
- Maxime Vasse
- mchelh
Expand Down Expand Up @@ -617,6 +619,7 @@ GitHub contributors:
- Pan P
- Pan Ploenes
- Panagiotis Tigas
- panariga
- panesarsandeep
- Pascal Cescon
- Patanock
Expand Down Expand Up @@ -737,6 +740,8 @@ GitHub contributors:
- sagaradonis
- Salim Benouamer
- Sam Berry
- sallemiines
- Sam
- Sam Sanchez
- Samir Shah
- Samuel
Expand All @@ -759,6 +764,7 @@ GitHub contributors:
- Sébastien Rufer
- Sébastien Sterckx
- SebSept
- sefirosweb
- seleda
- Serge Rivière
- Sergey P
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</h4>
{/if}
<span class="message-date">&nbsp;<i class="icon-calendar"></i> - {dateFormat date=$message.date_add full=0} - <i class="icon-time"></i> {$message.date_add|substr:11:5}</span>
{if isset($message.file_name)} <span class="message-product">&nbsp;<i class="icon-link"></i> <a href="{$message.file_name|escape:'html':'UTF-8'}" target="_blank" rel="noopener noreferrer nofollow">{l s="Attachment" d='Admin.Catalog.Feature'}</a></span>{/if}
{if isset($message.file_name)} <span class="message-product">&nbsp;<i class="icon-link"></i> <a href="{$message.file_link|escape:'html':'UTF-8'}" target="_blank" rel="noopener noreferrer nofollow">{l s="Attachment" d='Admin.Catalog.Feature'}</a></span>{/if}
{if isset($message.product_name)} <span class="message-attachment">&nbsp;<i class="icon-book"></i> <a href="{$message.product_link|escape:'html':'UTF-8'}" target="_blank" rel="noopener noreferrer nofollow">{l s="Product" d='Admin.Global'} {$message.product_name|escape:'html':'UTF-8'} </a></span>{/if}
<p class="message-item-text">{$message.message|escape:'html':'UTF-8'|nl2br}</p>
</div>
Expand Down
17 changes: 12 additions & 5 deletions classes/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ class DispatcherCore
* @var array List of default routes
*/
public $default_routes = [
'upload' => [
'controller' => 'upload',
'rule' => 'upload/{file}',
'keywords' => [
'file' => ['regexp' => '.+', 'param' => 'file'],
],
],
'category_rule' => [
'controller' => 'category',
'rule' => '{id}-{rewrite}',
Expand Down Expand Up @@ -1012,12 +1019,12 @@ public function getController($id_shop = null)
$controller = $this->controller_not_found;
$test_request_uri = preg_replace('/(=http:\/\/)/', '=', $this->request_uri);

// If the request_uri matches a static file, then there is no need to check the routes, we keep
// If the request_uri matches a static file, unless it's in the upload folder,
// then there is no need to check the routes, we keep
// "controller_not_found" (a static file should not go through the dispatcher)
if (!preg_match(
'/\.(gif|jpe?g|png|css|js|ico)$/i',
parse_url($test_request_uri, PHP_URL_PATH)
)) {
if (
!preg_match('/\.(gif|jpe?g|png|css|js|ico)$/i', parse_url($test_request_uri, PHP_URL_PATH))
|| preg_match('/^\/upload/', parse_url($test_request_uri, PHP_URL_PATH))) {
// Add empty route as last route to prevent this greedy regexp to match request uri before right time
if ($this->empty_route) {
$this->addRoute(
Expand Down
4 changes: 3 additions & 1 deletion classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -2460,7 +2460,9 @@ public static function generateHtaccess($path = null, $rewrite_settings = null,
fwrite($write_fd, 'RewriteRule . - [E=REWRITEBASE:' . $uri['physical'] . ']' . PHP_EOL);

// Webservice
fwrite($write_fd, 'RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]' . "\n\n");
fwrite($write_fd, 'RewriteRule ^api(?:/(.*))?$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]' . PHP_EOL);
// upload folder
fwrite($write_fd, 'RewriteRule ^upload/.+$ %{ENV:REWRITEBASE}index.php [QSA,L]' . "\n\n");

if (!$rewrite_settings) {
$rewrite_settings = (int) Configuration::get('PS_REWRITING_SETTINGS', null, null, (int) $uri['id_shop']);
Expand Down
Loading

0 comments on commit b710c70

Please sign in to comment.