fix(ruby): correct file name for conversion instead of changing download link

This commit is contained in:
sshakndr
2025-03-18 12:52:54 +07:00
parent c8288b3141
commit 1a73be6a12
3 changed files with 14 additions and 5 deletions

View File

@ -425,8 +425,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");

View File

@ -153,7 +153,8 @@ class HomeController < ApplicationController
key,
true,
file_pass,
lang
lang,
file_name
) # get the url and file type of the converted file and the conversion percentage
# if the conversion isn't completed, write file name and step values to the response

View File

@ -30,11 +30,20 @@ class ServiceConverter
@document_converter_url = ServiceConverter.config_manager.document_server_converter_uri.to_s
# get the url of the converted file
def self.get_converted_data(document_uri, from_ext, to_ext, document_revision_id, is_async, file_pass, lang = nil)
def self.get_converted_data(
document_uri,
from_ext,
to_ext,
document_revision_id,
is_async,
file_pass,
lang = nil,
title = nil
)
from_ext = File.extname(document_uri).downcase if from_ext.nil? # get the current document extension
# get the current document name or uuid
title = File.basename(URI.parse(document_uri).path)
title = File.basename(URI.parse(document_uri).path) if title.nil?
title = UUID.generate.to_s if title.nil?
# get the document key