From 12abf615833e2cabaee7ab729981b7c6cad58e26 Mon Sep 17 00:00:00 2001 From: sta Date: Wed, 23 Jun 2021 19:46:56 +0900 Subject: [PATCH] [Modify] Polish it --- websocket-sharp/Server/HttpServer.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/websocket-sharp/Server/HttpServer.cs b/websocket-sharp/Server/HttpServer.cs index 2bbf9b0a..f4dacdb5 100644 --- a/websocket-sharp/Server/HttpServer.cs +++ b/websocket-sharp/Server/HttpServer.cs @@ -402,14 +402,6 @@ namespace WebSocketSharp.Server value = value.TrimSlashOrBackslashFromEnd (); - string full = null; - try { - full = Path.GetFullPath (value); - } - catch (Exception ex) { - throw new ArgumentException ("An invalid path string.", "value", ex); - } - if (value == "/") throw new ArgumentException ("An absolute root.", "value"); @@ -419,10 +411,20 @@ namespace WebSocketSharp.Server if (value.Length == 2 && value[1] == ':') throw new ArgumentException ("An absolute root.", "value"); + string full = null; + + try { + full = Path.GetFullPath (value); + } + catch (Exception ex) { + throw new ArgumentException ("An invalid path string.", "value", ex); + } + if (full == "/") throw new ArgumentException ("An absolute root.", "value"); full = full.TrimSlashOrBackslashFromEnd (); + if (full.Length == 2 && full[1] == ':') throw new ArgumentException ("An absolute root.", "value");