mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-06-30 18:14:51 +00:00
MNT-24883 removed doc filter.
This commit is contained in:
parent
dfbde1c268
commit
89b273deaf
@ -55,7 +55,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.util.UriUtils;
|
||||
|
||||
import org.alfresco.transform.base.logging.LogEntry;
|
||||
import org.alfresco.transform.base.util.Util;
|
||||
import org.alfresco.transform.common.ExtensionService;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
|
||||
@ -81,7 +80,7 @@ public class FileManager
|
||||
.map(Part::getSubmittedFileName)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
file = (!StringUtils.isEmpty(submittedFileName) && Util.isDocFile(submittedFileName))
|
||||
file = !StringUtils.isEmpty(submittedFileName)
|
||||
? TempFileProvider.createTempDirForDocFile(submittedFileName)
|
||||
: TempFileProvider.createTempFile("source_", extension);
|
||||
}
|
||||
@ -103,16 +102,12 @@ public class FileManager
|
||||
}
|
||||
}
|
||||
|
||||
public static File createSourceDocFileWithSameName(HttpServletRequest request, String sourceFileName, InputStream inputStream, String sourceMimetype)
|
||||
public static File createSourceDocFileWithSameName(String sourceFileName, InputStream inputStream)
|
||||
{
|
||||
try
|
||||
{
|
||||
File file = TempFileProvider.createTempDirForDocFile(sourceFileName);
|
||||
Files.copy(inputStream, file.toPath(), REPLACE_EXISTING);
|
||||
if (request != null)
|
||||
{
|
||||
request.setAttribute(SOURCE_FILE, file);
|
||||
}
|
||||
LogEntry.setSource(file.getName(), file.length());
|
||||
return file;
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ import org.springframework.stereotype.Component;
|
||||
import org.alfresco.transform.base.TransformManager;
|
||||
import org.alfresco.transform.base.fs.FileManager;
|
||||
import org.alfresco.transform.base.util.OutputStreamLengthRecorder;
|
||||
import org.alfresco.transform.base.util.Util;
|
||||
|
||||
/**
|
||||
* Manages the input and output streams and any temporary files that have been created.
|
||||
@ -177,9 +176,8 @@ public class TransformManagerImpl implements TransformManager
|
||||
|
||||
if (sourceFile == null)
|
||||
{
|
||||
boolean isDocFile = !StringUtils.isEmpty(this.sourceFileName) && Util.isDocFile(this.sourceFileName);
|
||||
sourceFile = isDocFile
|
||||
? FileManager.createSourceDocFileWithSameName(request, this.sourceFileName, inputStream, sourceMimetype)
|
||||
sourceFile = request == null
|
||||
? FileManager.createSourceDocFileWithSameName(sourceFileName, inputStream)
|
||||
: FileManager.createSourceFile(request, inputStream, sourceMimetype);
|
||||
}
|
||||
return sourceFile;
|
||||
@ -226,7 +224,7 @@ public class TransformManagerImpl implements TransformManager
|
||||
{
|
||||
logger.error("Failed to delete temporary source file {}", sourceFile.getPath());
|
||||
}
|
||||
if (sourceFile != null && Util.isDocFile(sourceFile.getPath()))
|
||||
if (sourceFile != null)
|
||||
{
|
||||
File parentDir = sourceFile.getParentFile();
|
||||
if (parentDir != null
|
||||
|
@ -66,16 +66,4 @@ public class Util
|
||||
{
|
||||
return param == null ? null : Long.parseLong(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if given file name is a doc file
|
||||
*
|
||||
* @param filename
|
||||
* @return if file is .doc*
|
||||
*/
|
||||
public static boolean isDocFile(String filename)
|
||||
{
|
||||
String extension = filename.substring(filename.lastIndexOf('.'));
|
||||
return extension.startsWith(".doc");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user