mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
fix(java): correct file name for conversion instead of changing download link
This commit is contained in:
@ -303,7 +303,7 @@ public class IndexServlet extends HttpServlet {
|
||||
|
||||
// get the url and file type to the converted file
|
||||
Map<String, String> newFileData = ServiceConverter
|
||||
.getConvertedData(fileUri, fileExt, conversionExtension, key, filePass, true, lang);
|
||||
.getConvertedData(fileUri, fileExt, conversionExtension, key, filePass, true, lang, fileName);
|
||||
String newFileUri = newFileData.get("fileUrl");
|
||||
String newFileType = newFileData.get("fileType");
|
||||
|
||||
|
||||
@ -140,13 +140,13 @@ public final class ServiceConverter {
|
||||
public static Map<String, String> getConvertedData(final String documentUri, final String fromExtension,
|
||||
final String toExtension, final String documentRevisionId,
|
||||
final String filePass, final Boolean isAsync,
|
||||
final String lang) throws Exception {
|
||||
final String lang, final String filename) throws Exception {
|
||||
// check if the fromExtension parameter is defined; if not, get it from the document url
|
||||
String fromExt = fromExtension == null || fromExtension.isEmpty()
|
||||
? FileUtility.getFileExtension(documentUri) : fromExtension;
|
||||
|
||||
// check if the file name parameter is defined; if not, get random uuid for this file
|
||||
String title = FileUtility.getFileName(documentUri);
|
||||
String title = filename == null || filename.isEmpty() ? FileUtility.getFileName(documentUri) : filename;
|
||||
title = title == null || title.isEmpty() ? UUID.randomUUID().toString() : title;
|
||||
|
||||
String documentRevId = documentRevisionId == null || documentRevisionId.isEmpty()
|
||||
|
||||
@ -158,7 +158,7 @@ public final class TrackManager {
|
||||
String newFileUri = ServiceConverter
|
||||
.getConvertedData(downloadUri, downloadExt, curExt,
|
||||
ServiceConverter.generateRevisionId(downloadUri),
|
||||
null, false, null).get("fileUrl"); // convert file and get url to a new file
|
||||
null, false, null, null).get("fileUrl"); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
|
||||
// get the correct file name if it already exists
|
||||
@ -250,7 +250,7 @@ public final class TrackManager {
|
||||
String newFileUri = ServiceConverter
|
||||
.getConvertedData(downloadUri, downloadExt, curExt,
|
||||
ServiceConverter.generateRevisionId(downloadUri), null,
|
||||
false, null).get("fileUrl"); // convert file and get url to a new file
|
||||
false, null, null).get("fileUrl"); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
newFileName = true;
|
||||
} else {
|
||||
|
||||
@ -420,8 +420,7 @@ if (typeof jQuery !== "undefined") {
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
Reference in New Issue
Block a user