Explorar o código

修复LUA找不到脚本文件问题

xx %!s(int64=2) %!d(string=hai) anos
pai
achega
e041686c08
Modificáronse 1 ficheiros con 10 adicións e 17 borrados
  1. 10 17
      src/core/subscribemanager.cpp

+ 10 - 17
src/core/subscribemanager.cpp

@@ -127,27 +127,20 @@ void fastweb::subscribe_manager::other(network::http::request* request, network:
 		}
 	}
 
+	// 文件全路径
+	std::string absolute_path = app()->config->website.dir + filepath;
+	// 扩展名
 	std::string ext = ylib::file::ext(filepath);
-	// 判断LUA
-	if (ext == "lua")
+	if (ylib::file::exist(absolute_path) == false)
 	{
-		if (app()->config->website.direct_url_mapping)
-		{
-			callback(request,response,filepath,filepath);
-		}
-		else
-		{
-			send_404(response);
-		}
+		send_404(response);
+	}
+	else if(ext == "lua" && app()->config->website.direct_url_mapping)
+	{
+		callback(request, response, filepath, filepath);
 		return;
 	}
-
-	// 发送静态文件
-	std::string absolute_path = app()->config->website.dir + filepath;
-	if (ylib::file::exist(absolute_path))
-		response->send_file(absolute_path);
-	else
-		send_404(response);
+	response->send_file(absolute_path);
 }
 
 void fastweb::subscribe_manager::send_404(network::http::response* response)