Directory controller will now swallow errors that would otherwise return invalid data to the client (forcing an annoying alert to the client), no results are returned when this happens.
This commit is contained in:
parent
03c6dea53f
commit
ad89618f58
|
@ -16,11 +16,6 @@ namespace NzbDrone.Web.Controllers
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Test()
|
|
||||||
{
|
|
||||||
return Content("Testing...");
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult _autoCompletePath(string text, int? filterMode)
|
public ActionResult _autoCompletePath(string text, int? filterMode)
|
||||||
{
|
{
|
||||||
|
@ -34,6 +29,8 @@ namespace NzbDrone.Web.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectList GetDirectories(string text)
|
public SelectList GetDirectories(string text)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
//Windows (Including UNC)
|
//Windows (Including UNC)
|
||||||
var windowsSep = text.LastIndexOf('\\');
|
var windowsSep = text.LastIndexOf('\\');
|
||||||
|
@ -52,6 +49,11 @@ namespace NzbDrone.Web.Controllers
|
||||||
var dirs = _diskProvider.GetDirectories(text.Substring(0, index + 1));
|
var dirs = _diskProvider.GetDirectories(text.Substring(0, index + 1));
|
||||||
return new SelectList(dirs, dirs.FirstOrDefault());
|
return new SelectList(dirs, dirs.FirstOrDefault());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
//Swallow the exceptions so proper JSON is returned to the client (Empty results)
|
||||||
|
}
|
||||||
|
|
||||||
return new SelectList(new List<string>());
|
return new SelectList(new List<string>());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue