diff --git a/Apps.GitLab/Actions/RepositoryActions.cs b/Apps.GitLab/Actions/RepositoryActions.cs index 4e8d8ac..b7c6486 100644 --- a/Apps.GitLab/Actions/RepositoryActions.cs +++ b/Apps.GitLab/Actions/RepositoryActions.cs @@ -60,7 +60,12 @@ public async Task GetFile( repository.WebUrl, branch, RestClient.BaseUrl); - var fileData = FileHelper.ProcessDownloadedFile(fileToProcess, InvocationContext.Logger, getFileRequest.LanguageCode, getFileRequest.ContentId); + var fileData = FileHelper.ProcessDownloadedFile( + fileToProcess, + InvocationContext.Logger, + getFileRequest.LanguageCode, + getFileRequest.ContentId, + getFileRequest.ContentName); var fileReference = await fileManagementClient.UploadAsync(fileData.FileStream, fileData.MimeType, fileData.FileName); return new GetFileResponse diff --git a/Apps.GitLab/Apps.GitLab.csproj b/Apps.GitLab/Apps.GitLab.csproj index 8e195fe..4813ef0 100644 --- a/Apps.GitLab/Apps.GitLab.csproj +++ b/Apps.GitLab/Apps.GitLab.csproj @@ -6,7 +6,7 @@ enable GitLab GitLab is a developer platform that allows developers to create, store, and manage their code. This app focuses on connecting repository events and file actions into the Blackbird ecosystem. - 1.0.16 + 1.0.17 Apps.GitLab @@ -14,7 +14,7 @@ - + diff --git a/Apps.GitLab/Models/Respository/Requests/GetFileRequest.cs b/Apps.GitLab/Models/Respository/Requests/GetFileRequest.cs index 7fdee25..6f0384c 100644 --- a/Apps.GitLab/Models/Respository/Requests/GetFileRequest.cs +++ b/Apps.GitLab/Models/Respository/Requests/GetFileRequest.cs @@ -15,4 +15,7 @@ public class GetFileRequest [Display("Content ID", Description = "The ID of the content, used by Blacklake when diffing.")] public string? ContentId { get; set; } + + [Display("Content name")] + public string? ContentName { get; set; } } diff --git a/Apps.GitLab/Utils/File/FileHelper.cs b/Apps.GitLab/Utils/File/FileHelper.cs index 114275d..f10c3da 100644 --- a/Apps.GitLab/Utils/File/FileHelper.cs +++ b/Apps.GitLab/Utils/File/FileHelper.cs @@ -10,7 +10,12 @@ namespace Apps.GitLab.Utils.File; public static class FileHelper { - public static ProcessedDownloadedFile ProcessDownloadedFile(DownloadedFile downloadedFile, Logger? logger, string? language, string? contentId) + public static ProcessedDownloadedFile ProcessDownloadedFile( + DownloadedFile downloadedFile, + Logger? logger, + string? language, + string? contentId, + string? contentName) { var filename = Path.GetFileName(downloadedFile.Path); if (!MimeTypes.TryGetMimeType(filename, out var mimeType)) @@ -32,10 +37,10 @@ public static ProcessedDownloadedFile ProcessDownloadedFile(DownloadedFile downl fileContent.Language = language; fileContent.SystemReference.ContentId = contentId; fileContent.SystemReference.AdminUrl = editUrl; - fileContent.SystemReference.ContentName = filename; + fileContent.SystemReference.ContentName = string.IsNullOrWhiteSpace(contentName) ? filename : contentName; fileContent.SystemReference.SystemName = "Gitlab"; fileContent.SystemReference.SystemRef = "https://gitlab.com/"; return new(fileContent.ToStream(), mimeType, filename); } -} \ No newline at end of file +}