Skip to content

Commit 63b7641

Browse files
committed
csharp: fix - "Path not found" - error handled
1 parent 54f501c commit 63b7641

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

web/documentserver-example/csharp/WebEditor.ashx.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,11 +451,18 @@ private static void Reference(HttpContext context)
451451

452452
if (fileName == "" && userAddress != "")
453453
{
454-
var path = (string)body["path"];
455-
path = Path.GetFileName(path);
456-
if (File.Exists(_Default.StoragePath(path, userAddress)))
454+
try
457455
{
458-
fileName = path;
456+
var path = (string)body["path"];
457+
path = Path.GetFileName(path);
458+
if (File.Exists(_Default.StoragePath(path, userAddress)))
459+
{
460+
fileName = path;
461+
}
462+
}
463+
catch {
464+
context.Response.Write("{ \"error\": \"Path not found!\"}");
465+
return;
459466
}
460467
}
461468

0 commit comments

Comments
 (0)