ACS-1677 Provide file extension from JMS request if missing in SFS (#428)

This commit is contained in:
David Edwards 2021-06-15 16:39:28 +01:00 committed by GitHub
parent f831c46672
commit 74680fbe58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,7 +230,7 @@ public abstract class AbstractTransformerController implements TransformControll
File sourceFile; File sourceFile;
try try
{ {
sourceFile = loadSourceFile(request.getSourceReference()); sourceFile = loadSourceFile(request.getSourceReference(), request.getSourceExtension());
} }
catch (TransformException e) catch (TransformException e)
{ {
@ -358,9 +358,10 @@ public abstract class AbstractTransformerController implements TransformControll
* Loads the file with the specified sourceReference from Alfresco Shared File Store * Loads the file with the specified sourceReference from Alfresco Shared File Store
* *
* @param sourceReference reference to the file in Alfresco Shared File Store * @param sourceReference reference to the file in Alfresco Shared File Store
* @param sourceExtension default extension if the file in Alfresco Shared File Store has none
* @return the file containing the source content for the transformation * @return the file containing the source content for the transformation
*/ */
private File loadSourceFile(final String sourceReference) private File loadSourceFile(final String sourceReference, final String sourceExtension)
{ {
ResponseEntity<Resource> responseEntity = alfrescoSharedFileStoreClient ResponseEntity<Resource> responseEntity = alfrescoSharedFileStoreClient
.retrieveFile(sourceReference); .retrieveFile(sourceReference);
@ -369,7 +370,7 @@ public abstract class AbstractTransformerController implements TransformControll
HttpHeaders headers = responseEntity.getHeaders(); HttpHeaders headers = responseEntity.getHeaders();
String filename = getFilenameFromContentDisposition(headers); String filename = getFilenameFromContentDisposition(headers);
String extension = getFilenameExtension(filename); String extension = getFilenameExtension(filename) != null ? getFilenameExtension(filename) : sourceExtension;
MediaType contentType = headers.getContentType(); MediaType contentType = headers.getContentType();
long size = headers.getContentLength(); long size = headers.getContentLength();