diff --git a/src/Services.Core/Operations/UploadHandler.cs b/src/Services.Core/Operations/UploadHandler.cs index 1c6aa6dc0..8ce206d1c 100644 --- a/src/Services.Core/Operations/UploadHandler.cs +++ b/src/Services.Core/Operations/UploadHandler.cs @@ -325,6 +325,9 @@ public async Task ExecuteAsync(CancellationToken cancellationToken) // in case we just loaded this content SetPreviewGenerationPriority(uploadedContent); + var isContentType = uploadedContent.Path.StartsWith(Repository.ContentTypesFolderPath + "/", + StringComparison.OrdinalIgnoreCase); + if (FormFile != null) { await SaveFileToRepositoryAsync(uploadedContent, Content, chunkToken, @@ -333,7 +336,9 @@ await SaveFileToRepositoryAsync(uploadedContent, Content, chunkToken, else { // handle text data - var binData = new BinaryData { FileName = new BinaryFileName(uploadedContent.Name) }; + var binData = isContentType + ? new BinaryData {FileName = new BinaryFileName(uploadedContent.Name + ".ContentType"), ContentType = "text/xml"} + : new BinaryData {FileName = new BinaryFileName(uploadedContent.Name) }; // set content type only if we were unable to recognize it if (string.IsNullOrEmpty(binData.ContentType))