diff --git a/src/requests_handling/requestImplementation/Get.cpp b/src/requests_handling/requestImplementation/Get.cpp index 266fda3..3fb0fee 100644 --- a/src/requests_handling/requestImplementation/Get.cpp +++ b/src/requests_handling/requestImplementation/Get.cpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/30 09:40:16 by adjoly #+# #+# */ -/* Updated: 2025/06/24 18:02:19 by adjoly ### ########.fr */ +/* Updated: 2025/06/30 15:03:52 by mmoussou ### ########.fr */ /* */ /* ************************************************************************** */ @@ -71,10 +71,6 @@ void Get::parse(std::string const &data) { std::string targ = _target; - if (targ[targ.length() - 1] == '/') { - targ += _route->getIndex(); - } - if (_route->isCgi(targ)) { _log->debug("cgi added"); try { @@ -162,6 +158,10 @@ Response Get::execute(void) { this->_target = this->_route->getRootDir() + this->_target; try { + if (!access((this->_target + (this->_target[this->_target.length() - 1] != '/' ? std::string("/") : "") + _route->getIndex()).c_str(), R_OK)) + { + this->_target += (this->_target[this->_target.length() - 1] != '/' ? std::string("/") : "") + _route->getIndex(); + } if (isDirectory(this->_target)) { if (!access((this->_target + this->_route->getIndex()).c_str(), R_OK)) {