Only expose the filename when uploading content types (#12813)

This commit is contained in:
Bjarke Berg
2022-08-09 16:27:46 +02:00
committed by GitHub
parent 274e7c5302
commit 00ffe7a6b3

View File

@@ -571,7 +571,7 @@ public class ContentTypeController : ContentTypeControllerBase<IContentType>
[Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentTypes)]
public IActionResult Import(string file)
{
var filePath = Path.Combine(_hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.Data), file);
var filePath = Path.Combine(_hostingEnvironment.MapPathContentRoot(Constants.SystemDirectories.TempFileUploads), file);
if (string.IsNullOrEmpty(file) || !System.IO.File.Exists(filePath))
{
return NotFound();
@@ -623,10 +623,10 @@ public class ContentTypeController : ContentTypeControllerBase<IContentType>
if (ext.InvariantEquals("udt"))
{
model.TempFileName = Path.Combine(root, fileName);
model.TempFileName = fileName;
var xd = new XmlDocument { XmlResolver = null };
xd.Load(model.TempFileName);
xd.Load(Path.Combine(root, fileName));
model.Alias = xd.DocumentElement?.SelectSingleNode("//DocumentType/Info/Alias")?.FirstChild?.Value;
model.Name = xd.DocumentElement?.SelectSingleNode("//DocumentType/Info/Name")?.FirstChild?.Value;