mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-28 23:52:36 +01:00
Fix configuration conflict exceptions
This commit is contained in:
@@ -216,10 +216,6 @@ namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
Path = configurationRelativePath
|
||||
};
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
logger.LogDebug("IOException while reading {0}: {1}", path, e);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
//this happens on windows, dunno about linux
|
||||
@@ -308,10 +304,6 @@ namespace Tgstation.Server.Host.Components.StaticFiles
|
||||
Path = configurationRelativePath
|
||||
};
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
logger.LogDebug("IOException while writing {0}: {1}", path, e);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
//this happens on windows, dunno about linux
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -54,12 +55,23 @@ namespace Tgstation.Server.Host.Controllers
|
||||
{
|
||||
var newFile = await config.Write(model.Path, AuthenticationContext.SystemIdentity, model.Content, model.LastReadHash, cancellationToken).ConfigureAwait(false);
|
||||
if (newFile == null)
|
||||
return Conflict();
|
||||
return Conflict(new ErrorMessage
|
||||
{
|
||||
Message = ""
|
||||
});
|
||||
|
||||
newFile.Content = null;
|
||||
|
||||
return model.LastReadHash == null ? (IActionResult)StatusCode((int)HttpStatusCode.Created, newFile) : Json(newFile);
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
Logger.LogInformation("IOException while updating file {0}: {1}", model.Path, e);
|
||||
return Conflict(new ErrorMessage
|
||||
{
|
||||
Message = e.Message
|
||||
});
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
return StatusCode((int)HttpStatusCode.NotImplemented);
|
||||
@@ -87,6 +99,14 @@ namespace Tgstation.Server.Host.Controllers
|
||||
|
||||
return Json(result);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Logger.LogInformation("IOException while reading file {0}: {1}", filePath, e);
|
||||
return Conflict(new ErrorMessage
|
||||
{
|
||||
Message = e.Message
|
||||
});
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
return StatusCode((int)HttpStatusCode.NotImplemented);
|
||||
|
||||
@@ -330,7 +330,6 @@ namespace Tgstation.Server.Host.Controllers
|
||||
var api = canRead ? currentModel.ToApi() : new Repository();
|
||||
var repoManager = instanceManager.GetInstance(Instance).RepositoryManager;
|
||||
|
||||
|
||||
if (canRead)
|
||||
{
|
||||
if (repoManager.CloneInProgress)
|
||||
|
||||
Reference in New Issue
Block a user