|
|
|
@ -65,7 +65,8 @@ namespace Volo.Docs.Documents
|
|
|
|
|
{
|
|
|
|
|
var project = await _projectRepository.GetAsync(input.ProjectId);
|
|
|
|
|
|
|
|
|
|
input.Version = GetProjectVersionPrefixIfExist(project) + input.Version;
|
|
|
|
|
var inputVersionStringBuilder = new StringBuilder();
|
|
|
|
|
input.Version = inputVersionStringBuilder.Append(GetProjectVersionPrefixIfExist(project)).Append(input.Version).ToString();
|
|
|
|
|
|
|
|
|
|
return await GetDocumentWithDetailsDtoAsync(
|
|
|
|
|
project,
|
|
|
|
@ -79,11 +80,14 @@ namespace Volo.Docs.Documents
|
|
|
|
|
{
|
|
|
|
|
var project = await _projectRepository.GetAsync(input.ProjectId);
|
|
|
|
|
|
|
|
|
|
input.Version = GetProjectVersionPrefixIfExist(project) + input.Version;
|
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
|
input.Version = sb.Append(GetProjectVersionPrefixIfExist(project)).Append(input.Version).ToString();
|
|
|
|
|
|
|
|
|
|
sb.Clear();
|
|
|
|
|
|
|
|
|
|
return await GetDocumentWithDetailsDtoAsync(
|
|
|
|
|
project,
|
|
|
|
|
project.DefaultDocumentName + "." + project.Format,
|
|
|
|
|
sb.Append(project.DefaultDocumentName).Append(".").Append(project.Format).ToString(),
|
|
|
|
|
input.LanguageCode,
|
|
|
|
|
input.Version
|
|
|
|
|
);
|
|
|
|
@ -226,7 +230,7 @@ namespace Volo.Docs.Documents
|
|
|
|
|
private async Task AddDocumentToUrls(string prefix, Project project, DocumentWithoutDetails document,
|
|
|
|
|
List<string> documentUrls)
|
|
|
|
|
{
|
|
|
|
|
var navigationNodes = await GetNavigationNodesAsync(prefix, project, document);
|
|
|
|
|
var navigationNodes = await GetNavigationNodesAsync(project, document);
|
|
|
|
|
AddDocumentUrls(prefix, navigationNodes, documentUrls, project, document);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -244,7 +248,7 @@ namespace Volo.Docs.Documents
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task<List<NavigationNode>> GetNavigationNodesAsync(string prefix, Project project,
|
|
|
|
|
private async Task<List<NavigationNode>> GetNavigationNodesAsync(Project project,
|
|
|
|
|
DocumentWithoutDetails document)
|
|
|
|
|
{
|
|
|
|
|
var version = GetProjectVersionPrefixIfExist(project) + document.Version;
|
|
|
|
@ -286,10 +290,12 @@ namespace Volo.Docs.Documents
|
|
|
|
|
private string NormalizePath(string prefix, string path, string shortName, DocumentWithoutDetails document)
|
|
|
|
|
{
|
|
|
|
|
var pathWithoutFileExtension = RemoveFileExtensionFromPath(path, document.Format);
|
|
|
|
|
var normalizedPath = prefix + document.LanguageCode + "/" + shortName + "/" + document.Version + "/" +
|
|
|
|
|
pathWithoutFileExtension;
|
|
|
|
|
|
|
|
|
|
return normalizedPath;
|
|
|
|
|
var normalizedPathStringBuilder = new StringBuilder();
|
|
|
|
|
normalizedPathStringBuilder.Append(prefix).Append(document.LanguageCode).Append("/").Append(shortName)
|
|
|
|
|
.Append("/").Append(document.Version).Append("/").Append(pathWithoutFileExtension);
|
|
|
|
|
|
|
|
|
|
return normalizedPathStringBuilder.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string RemoveFileExtensionFromPath(string path, string format)
|
|
|
|
@ -375,21 +381,6 @@ namespace Volo.Docs.Documents
|
|
|
|
|
return await GetDocumentAsync(documentName, project, languageCode, version, document);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cacheKey = CacheKeyGenerator.GenerateDocumentUpdateInfoCacheKey(
|
|
|
|
|
project,
|
|
|
|
|
document.Name,
|
|
|
|
|
document.LanguageCode,
|
|
|
|
|
document.Version
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await DocumentUpdateCache.SetAsync(cacheKey, new DocumentUpdateInfo
|
|
|
|
|
{
|
|
|
|
|
Name = document.Name,
|
|
|
|
|
CreationTime = document.CreationTime,
|
|
|
|
|
LastUpdatedTime = document.LastUpdatedTime,
|
|
|
|
|
LastSignificantUpdateTime = document.LastSignificantUpdateTime
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return CreateDocumentWithDetailsDto(project, document);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|