fix(csharp-mvc): correct download name of converted file. Fix Bug 73522

This commit is contained in:
sshakndr
2025-03-17 13:24:56 +07:00
parent 5d23ac7572
commit 9378e4313b
3 changed files with 5 additions and 5 deletions

View File

@ -83,7 +83,8 @@ namespace OnlineEditorsExampleMVC.Helpers
bool isAsync, bool isAsync,
out Dictionary<string, string> convertedDocumentData, out Dictionary<string, string> convertedDocumentData,
string filePass = null, string filePass = null,
string lang = null) string lang = null,
string fileName = null)
{ {
convertedDocumentData = new Dictionary<string, string>(); convertedDocumentData = new Dictionary<string, string>();
@ -91,7 +92,7 @@ namespace OnlineEditorsExampleMVC.Helpers
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension; fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension;
// check if the file name parameter is defined; if not, get random uuid for this file // check if the file name parameter is defined; if not, get random uuid for this file
var title = Path.GetFileName(documentUri); var title = string.IsNullOrEmpty(fileName) ? Path.GetFileName(documentUri) : fileName;
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title; title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
// get document key // get document key

View File

@ -421,8 +421,7 @@ if (typeof jQuery != "undefined") {
jq("#beginViewConverted").removeClass("disable"); jq("#beginViewConverted").removeClass("disable");
jq("#downloadConverted").attr("data","fromStorage"); jq("#downloadConverted").attr("data","fromStorage");
} else { } else {
let newFilename = fileName.split('.').slice(0,-1).join('.') jq("#hiddenFileName").attr("data",response.filename);
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
jq("#downloadConverted").attr("data","fromConverter"); jq("#downloadConverted").attr("data","fromConverter");
} }
jq("td[name='convertingTypeButton']").removeClass("disable orange"); jq("td[name='convertingTypeButton']").removeClass("disable orange");

View File

@ -280,7 +280,7 @@ namespace OnlineEditorsExampleMVC
// get the url and file type of the converted file // get the url and file type of the converted file
Dictionary<string, string> newFileData; Dictionary<string, string> newFileData;
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang); var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang, fileName);
if (result != 100) if (result != 100)
{ {
context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}"); context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");