Commit 4e06ef33 authored by konovalovsergey's avatar konovalovsergey

for bug 33808. 255 chars limit for download title.

parent f38d7537
......@@ -726,7 +726,7 @@ var editor;
oAdditionalData["userid"] = this.documentUserId;
oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt();
oAdditionalData["outputformat"] = sFormat;
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(sFormat));
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(sFormat), Asc.c_nMaxDownloadTitleLen);
if (DownloadType.Print === options.downloadType) {
oAdditionalData["inline"] = 1;
}
......
......@@ -44,6 +44,7 @@
var c_oAscMaxColumnWidth = 255;
var c_oAscMaxRowHeight = 409;
var c_nMaxConversionTime = 900000;//depends on config
var c_nMaxDownloadTitleLen= 255;
//files type for Saving & DownloadAs
var c_oAscFileType = {
......@@ -1081,6 +1082,7 @@
window['Asc']['c_oAscMaxColumnWidth'] = window['Asc'].c_oAscMaxColumnWidth = c_oAscMaxColumnWidth;
window['Asc']['c_oAscMaxRowHeight'] = window['Asc'].c_oAscMaxRowHeight = c_oAscMaxRowHeight;
window['Asc']['c_nMaxConversionTime'] = window['Asc'].c_nMaxConversionTime = c_nMaxConversionTime;
window['Asc']['c_nMaxDownloadTitleLen'] = window['Asc'].c_nMaxDownloadTitleLen = c_nMaxDownloadTitleLen;
window['Asc']['c_oAscFileType'] = window['Asc'].c_oAscFileType = c_oAscFileType;
prot = c_oAscFileType;
prot['UNKNOWN'] = prot.UNKNOWN;
......
......@@ -861,10 +861,14 @@ function GetFileExtension (sName) {
return sName.substring(nIndex + 1).toLowerCase();
return null;
}
function changeFileExtention (sName, sNewExt) {
function changeFileExtention (sName, sNewExt, opt_lengthLimit) {
var sOldExt = GetFileExtension(sName);
if(sOldExt) {
return sName.substring(0, sName.length - sOldExt.length) + sNewExt;
var nIndexEnd = sOldExt ? sName.length - sOldExt.length - 1 : sName.length;
if (opt_lengthLimit && nIndexEnd + sNewExt.length + 1 > opt_lengthLimit) {
nIndexEnd = opt_lengthLimit - sNewExt.length - 1;
}
if(nIndexEnd < sName.length) {
return sName.substring(0, nIndexEnd) + '.' + sNewExt;
} else {
return sName + '.' + sNewExt;
}
......
......@@ -6063,7 +6063,7 @@ background-repeat: no-repeat;\
oAdditionalData["userid"] = this.documentUserId;
oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt();
oAdditionalData["outputformat"] = filetype;
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype));
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype), Asc.c_nMaxDownloadTitleLen);
oAdditionalData["savetype"] = AscCommon.c_oAscSaveTypes.CompleteAll;
if (DownloadType.Print === options.downloadType)
{
......
......@@ -6464,7 +6464,7 @@ background-repeat: no-repeat;\
oAdditionalData["userid"] = this.documentUserId;
oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt();
oAdditionalData["outputformat"] = filetype;
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype));
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype), Asc.c_nMaxDownloadTitleLen);
oAdditionalData["savetype"] = AscCommon.c_oAscSaveTypes.CompleteAll;
if ('savefromorigin' === command)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment