mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
fix(csharp-mvc): correct download name of converted file. Fix Bug 73522
This commit is contained in:
@ -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
|
||||||
|
|||||||
@ -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");
|
||||||
|
|||||||
@ -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 + "\"}");
|
||||||
|
|||||||
Reference in New Issue
Block a user