Skip to content

Commit 78e2c06

Browse files
committed
Update HttpFileExecutorAsync.cs
1 parent 5549103 commit 78e2c06

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

plugins/magic.endpoint/magic.endpoint/magic.endpoint.services/HttpFileExecutorAsync.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async Task<MagicResponse> ServeHtmlFileAsync(MagicRequest request)
172172
return await Serve404Page(request);
173173

174174
// Checking if Hyperlambda codebehind file exists.
175-
var codebehindFile = (file.Contains('.') ? file.Substring(0, file.LastIndexOf('.')) : file.Substring(0, file.Length - 6)) + ".hl";
175+
var codebehindFile = (file.Contains('.') ? file.Substring(0, file.LastIndexOf('.')) : file) + ".hl";
176176
if (await _fileService.ExistsAsync(_rootResolver.AbsolutePath(codebehindFile)))
177177
return await ServeDynamicPage(request, file, codebehindFile); // Codebehind file exists.
178178

@@ -260,17 +260,17 @@ await _signaler.ScopeAsync("slots.result", result, async () =>
260260
*/
261261
async Task<string> GetHtmlFilename(string url)
262262
{
263-
// Checking if this is a request for a folder, at which point we append "index.html" to it.
263+
// Checking if this is a request for root folder, at which point we append "index.html" to it.
264264
if (url == "")
265-
url = "/index";
266-
if (url.StartsWith('/'))
265+
url = "index";
266+
else if (url.StartsWith('/'))
267267
url = url.Substring(1);
268268

269269
// Trying to resolve URL as a direct filename request.
270270
if (await _fileService.ExistsAsync(_rootResolver.AbsolutePath("/etc/www/" + url)))
271271
return "/etc/www/" + url;
272272

273-
// Trying to resolve URL as a direct filename request.
273+
// Trying to resolve URL as a direct filename request with HTML extension.
274274
if (await _fileService.ExistsAsync(_rootResolver.AbsolutePath("/etc/www/" + url + ".html")))
275275
return "/etc/www/" + url + ".html";
276276

0 commit comments

Comments
 (0)