Anomalie #17480
openRedirection en boucle car mauvaise gestion d’erreur
Description
Maarch Courrier develop & 21.03
Si le fichier de configuration config.json est introuvable, ou illisible pour des problèmes de droits, l’API devrait renvoyer un message d’erreur clair, or ce n’est pas toujours le cas.
Dans le cas où l’application est installée dans un dossier, par exemple /var/www/html/MaarchCourrier/
, et que custom/custom.json
contient :
{
[
"id": "nom_client",
"uri": null,
"path": "MaarchCourrier"
]
}
Dans ce cas précis on obtient une redirection en boucle, vers https://mon-serveur.fr/MaarchCourrier/MaarchCourrier/MaarchCourrier/...
Il serait utile de corriger ce problème afin de permettre aux intégrateurs de mieux diagnostiquer les erreurs.
Correction possible :
diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php
index fe63275807..3445b055bb 100755
--- a/src/core/controllers/AuthenticationController.php
+++ b/src/core/controllers/AuthenticationController.php
@@ -116,7 +116,11 @@ class AuthenticationController
$url = null;
if (!empty($jsonFile[0]['path'])) {
$coreUrl = UrlController::getCoreUrl();
- $url = $coreUrl . $jsonFile[0]['path'] . "/dist/index.html";
+ $url = rtrim($coreUrl, '/').'/';
+ if (basename($coreUrl) != trim($jsonFile[0]['path'], '/')) {
+ $url .= trim($jsonFile[0]['path'], '/').'/';
+ }
+ $url .= 'dist/index.html';
} elseif (!empty($jsonFile[0]['uri'])) {
$url = $jsonFile[0]['uri'] . "/dist/index.html";
}
Ici on n’ajouterait la variable path
du custom seulement si elle est différente du chemin de la racine de l’application, évitant ainsi de rediriger vers /MaarchCourrier/MaarchCourrier/
.
Updated by Emmanuel DILLARD over 3 years ago
- Due date set to 06/21/2021
- Status changed from A traiter to Etude planifiée
- Target version set to 21.03
Updated by Emmanuel DILLARD over 3 years ago
- Due date deleted (
06/21/2021) - Status changed from Etude planifiée to R&D - A planifier
- Assignee set to EDI PO
Updated by Emmanuel DILLARD over 1 year ago
- Status changed from R&D - A planifier to R&D - A étudier
Updated by Emmanuel DILLARD 5 months ago
- Target version changed from 21.03 to Inscription Backlog
Updated by Emmanuel DILLARD 3 months ago
- Target version deleted (
Inscription Backlog)