From a4dc8559352ea3b95963ff9e3b3a1f9fed2fe8aa Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 28 Apr 2026 08:45:33 +0000
Subject: [PATCH 1/3] Initial plan
From 81d5a0f86ef157587eb33c38d8e77b3acba429d2 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 28 Apr 2026 09:01:32 +0000
Subject: [PATCH 2/3] fix: replace ES6+ syntax with ES5-compatible code for IE
compatibility
Agent-Logs-Url: https://github.com/scanfing/HttpFileServer/sessions/71571c95-165e-4cf6-856c-5a6464a6b298
Co-authored-by: scanfing <9262469+scanfing@users.noreply.github.com>
---
.../Resources/HtmlTemplate.html | 319 +++++++++++-------
.../Resources/UploadSection.html | 318 +++++++++++------
2 files changed, 413 insertions(+), 224 deletions(-)
diff --git a/src/HttpFileServer/Resources/HtmlTemplate.html b/src/HttpFileServer/Resources/HtmlTemplate.html
index 9fb59f9..5cc5aad 100644
--- a/src/HttpFileServer/Resources/HtmlTemplate.html
+++ b/src/HttpFileServer/Resources/HtmlTemplate.html
@@ -1,4 +1,4 @@
-
+
@@ -92,9 +92,9 @@ {
+ if (arrayIncludes(imageExtensions, fileExtension)) {
+ var img = new Image();
+ img.onload = function() {
popover.innerHTML = '';
popover.appendChild(img);
positionPopover(coords);
};
- img.onerror = () => {
+ img.onerror = function() {
popover.innerHTML = '
图片加载失败
';
};
- img.src = `./${fileName}`;
+ img.src = './' + fileName;
img.style.maxWidth = '260px';
- } else if (['txt', 'md', 'html', 'js', 'css', 'json', 'log', 'xml', 'bat'].includes(fileExtension)) {
- fetch(`./${fileName}`)
- .then(r => r.text())
- .then(text => {
- const pre = document.createElement('pre');
- if (text.length > 800) text = text.slice(0, 800) + '\n...';
- pre.textContent = text;
- popover.innerHTML = '';
- popover.appendChild(pre);
- positionPopover(coords);
- })
- .catch(() => {
- popover.innerHTML = '预览失败
';
- });
+ } else if (arrayIncludes(textExtensions, fileExtension)) {
+ if (typeof fetch === 'function') {
+ fetch('./' + fileName)
+ .then(function(r) { return r.text(); })
+ .then(function(text) {
+ var pre = document.createElement('pre');
+ if (text.length > 800) text = text.slice(0, 800) + '\n...';
+ pre.textContent = text;
+ popover.innerHTML = '';
+ popover.appendChild(pre);
+ positionPopover(coords);
+ })
+ .catch(function() {
+ popover.innerHTML = '预览失败
';
+ });
+ } else {
+ popover.innerHTML = '不支持预览
';
+ }
} else {
popover.innerHTML = '不支持预览
';
}
@@ -256,39 +297,54 @@ 上传文件
\ No newline at end of file
From 8c3ec8c81500da51c1b00f0aa4772c86e704827e Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 28 Apr 2026 09:04:02 +0000
Subject: [PATCH 3/3] fix: remove accidentally-added UTF-8 BOM from
HtmlTemplate.html
Agent-Logs-Url: https://github.com/scanfing/HttpFileServer/sessions/71571c95-165e-4cf6-856c-5a6464a6b298
Co-authored-by: scanfing <9262469+scanfing@users.noreply.github.com>
---
src/HttpFileServer/Resources/HtmlTemplate.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/HttpFileServer/Resources/HtmlTemplate.html b/src/HttpFileServer/Resources/HtmlTemplate.html
index 5cc5aad..5c2b45c 100644
--- a/src/HttpFileServer/Resources/HtmlTemplate.html
+++ b/src/HttpFileServer/Resources/HtmlTemplate.html
@@ -1,4 +1,4 @@
-
+