Compare commits

..

2 Commits

5 changed files with 13 additions and 11 deletions

View File

@ -121,7 +121,7 @@ if (typeof jQuery != "undefined") {
jq("#filePass").val("");
var fileName = jq("#hiddenFileName").val();
var posExt = fileName.lastIndexOf('.');
var posExt = fileName.lastIndexOf('.') + 1;
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
if (!formatManager.isAutoConvertible(posExt)) {

View File

@ -121,7 +121,7 @@ if (typeof jQuery != "undefined") {
jq("#filePass").val("");
var fileName = jq("#hiddenFileName").val();
var posExt = fileName.lastIndexOf('.');
var posExt = fileName.lastIndexOf('.') + 1;
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
if (!formatManager.isAutoConvertible(posExt)) {

View File

@ -61,7 +61,8 @@ documentService.getConvertedUri = function getConvertedUri(
filePass = null,
lang = null,
) {
const fromExt = fromExtension || fileUtility.getFileExtension(documentUri); // get the current document extension
// get the current document extension
const fromExt = fromExtension || fileUtility.getFileExtension(documentUri, false, true);
// get the current document name or uuid
const title = fileUtility.getFileNameFromUrl(documentUri) || guidManager.newGuid();

View File

@ -50,20 +50,21 @@ fileUtility.getFileName = function getFileName(path, withoutExtension) {
return fileName;
};
// get file extension from the given url
fileUtility.getFileExtension = function getFileExtension(url, withoutDot) {
if (!url) return null;
// get file extension from the given path
fileUtility.getFileExtension = function getFileExtension(path, withoutDot, isUrl) {
if (!path) return null;
const fileName = fileUtility.getFileNameFromUrl(url); // get file name from the given url
// get file name from the given path
const fileName = isUrl ? fileUtility.getFileNameFromUrl(path) : fileUtility.getFileName(path);
const parts = fileName.toLowerCase().split('.');
return withoutDot ? parts.pop() : `.${parts.pop()}`; // get the extension from the file name with or without dot
};
// get file type from the given url
fileUtility.getFileType = function getFileType(url) {
const ext = fileUtility.getFileExtension(url, true); // get the file extension from the given url
// get file type from the given path
fileUtility.getFileType = function getFileType(path) {
const ext = fileUtility.getFileExtension(path, true); // get the file extension from the given path
for (let i = 0; i < supportedFormats.length; i++) {
if (supportedFormats[i].name === ext && supportedFormats[i].type !== '') return supportedFormats[i].type;

View File

@ -121,7 +121,7 @@ if (typeof jQuery !== "undefined") {
jq("#filePass").val("");
var fileName = jq("#hiddenFileName").val();
var posExt = fileName.lastIndexOf(".");
var posExt = fileName.lastIndexOf(".") + 1;
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : "";
if (!formatManager.isAutoConvertible(posExt)) {