Anomalie #17480
Redirection 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';
}
$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/
.
History
#1 Updated by Emmanuel DILLARD 11 months ago
- Due date set to 06/21/2021
- Status changed from A traiter to Etude planifiée
- Target version set to 21.03 (stable)
#2 Updated by Emmanuel DILLARD 11 months ago
- Due date deleted (
06/21/2021) - Status changed from Etude planifiée to Prêt à développer
- Assignee set to EDI PO
#3 Updated by Emmanuel DILLARD 8 months ago
- Assignee deleted (
EDI PO)