From 506704fd90740f1ed3a057b9052d19c4407e23fb Mon Sep 17 00:00:00 2001 From: xRain Date: Wed, 10 Jul 2024 06:29:36 +0800 Subject: [PATCH] =?UTF-8?q?fix=20fullurl=20=E4=B8=8D=E6=8A=9B=E5=87=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Helpers/SimApiStorage.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Helpers/SimApiStorage.cs b/Helpers/SimApiStorage.cs index 52d59a8..8c2a68c 100644 --- a/Helpers/SimApiStorage.cs +++ b/Helpers/SimApiStorage.cs @@ -114,8 +114,9 @@ public class SimApiStorage /// public string FullUrl(string path) { + if (string.IsNullOrEmpty(path)) return path; if(path.StartsWith("http://") || path.StartsWith("https://")) return path; - if (!(path.StartsWith('/') || path.StartsWith("~/"))) throw new Exception("path must start with / or ~/"); + if (!(path.StartsWith('/') || path.StartsWith("~/"))) return path; var httpRequest = HttpContextAccessor.HttpContext?.Request; var url = $"{httpRequest?.Scheme}://{httpRequest?.Host}"; if (string.IsNullOrEmpty(path))