Skip to content

Commit

Permalink
[SITES-21186] Issue with uploading .pptx and other file types in AEM …
Browse files Browse the repository at this point in the history
…Download Core Component (#2731)

Added option to upload pptx files to download component
  • Loading branch information
YahorC authored Apr 18, 2024
1 parent 5f19d6c commit 5e843b2
Show file tree
Hide file tree
Showing 17 changed files with 139 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
fieldLabel="Download Asset"
fileNameParameter="./fileName"
fileReferenceParameter="./fileReference"
mimeTypes="[image/*,video/*,audio/*,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,application/zip,text/plain,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet]"
mimeTypes="[image/*,video/*,audio/*,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/pdf,application/zip,text/plain,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation]"
name="./file"/>
</items>
</column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public class DownloadIT extends com.adobe.cq.wcm.core.components.it.seljup.tests
private static final String testAssetXlsxName = "core-comp-test-xlsx.xlsx";
private static final String testAssetXlsxPath = testAssetsPath + "/" + testAssetXlsxName;

private static final String testAssetPptxName = "core-comp-test-pptx.pptx";

private static final String testAssetPptxPath = testAssetsPath + "/" + testAssetPptxName;

private void setupResources() {
downloadRT = RT_DOWNLOAD_V2;
}
Expand All @@ -69,6 +73,13 @@ public void downloadXlsxFile() throws TimeoutException, InterruptedException, Cl
assertEquals("attachment; filename=\"" + testAssetXlsxName + "\"", headers[0].getValue());
}

@Test
public void downloadPptxFile() throws TimeoutException, InterruptedException, ClientException, URISyntaxException {
Header[] headers = getDownloadedFileHeaders(testAssetPptxPath);
assertTrue(headers.length > 0);
assertEquals("attachment; filename=\"" + testAssetPptxName + "\"", headers[0].getValue());
}

private Header[] getDownloadedFileHeaders (String testAssetPath) throws InterruptedException, TimeoutException, URISyntaxException, ClientException {
Commons.openSidePanel();
Commons.useDialogSelect("assetfilter_type_selector", "Documents");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:dam="http://www.day.com/dam/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"
jcr:mixinTypes="[mix:referenceable]"
jcr:primaryType="dam:Asset"
jcr:uuid="4a72941d-6041-4dbe-88b3-a006cfcf0a95">
<jcr:content
dam:assetState="processed"
jcr:lastModified="{Date}2024-04-16T14:14:21.311+02:00"
jcr:lastModifiedBy="admin"
jcr:primaryType="dam:AssetContent">
<metadata
dam:Application="Microsoft Office PowerPoint"
dam:AppVersion="{Decimal}14.0000"
dam:created="{Date}2011-12-30T10:34:04.000Z"
dam:extracted="{Date}2024-04-16T14:14:20.604+02:00"
dam:HeadingPairs="Theme1Slide Titles1"
dam:HiddenSlides="{Long}0"
dam:HyperlinksChanged="false"
dam:i4="{Long}1"
dam:lastModifiedBy="muthu"
dam:LinksUpToDate="false"
dam:lpstr="PowerPoint Presentation"
dam:MMClips="{Long}0"
dam:modified="{Date}2011-12-30T10:40:39.000Z"
dam:Notes="{Long}0"
dam:numPages="{Long}1"
dam:Paragraphs="{Long}7"
dam:PresentationFormat="On-screen Show (4:3)"
dam:revision="{Long}3"
dam:ScaleCrop="false"
dam:sha1="590aa4b373f559f8e4e2a01f6de12e5702211af1"
dam:SharedDoc="false"
dam:size="{Long}60908"
dam:Slides="{Long}1"
dam:TitlesOfParts="Office ThemePowerPoint Presentation"
dam:TotalTime="{Long}6"
dam:variant="{Long}1"
dam:vector="Office ThemePowerPoint Presentation"
dam:Words="{Long}37"
dc:creator="[muthu]"
dc:creator_xmpArrayType="rdf:Bag"
dc:format="application/vnd.openxmlformats-officedocument.presentationml.presentation"
dc:modified="{Date}2024-04-16T14:14:20.501+02:00"
dc:title="Test PPTX"
jcr:lastModified="{Date}2024-04-16T14:14:20.501+02:00"
jcr:lastModifiedBy="admin"
jcr:mixinTypes="[cq:Taggable]"
jcr:primaryType="nt:unstructured"
jcr:title="Test PPTX"/>
<related jcr:primaryType="nt:unstructured">
<pages
jcr:primaryType="nt:unstructured"
sling:resourceType="sling/collection">
<sling:members
jcr:primaryType="nt:unstructured"
sling:resources="[/content/dam/core-components/core-comp-test-pptx.pptx/subassets/slide_1.pptx]">
<slide_1.pptx
jcr:primaryType="nt:unstructured"
sling:resource="/content/dam/core-components/core-comp-test-pptx.pptx/subassets/slide_1.pptx"/>
</sling:members>
</pages>
</related>
</jcr:content>
</jcr:root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="workflow-process-service"
jcr:primaryType="oak:Resource"/>
</jcr:root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="workflow-process-service"
jcr:primaryType="oak:Resource"/>
</jcr:root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="workflow-process-service"
jcr:primaryType="oak:Resource"/>
</jcr:root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="workflow-process-service"
jcr:primaryType="oak:Resource"/>
</jcr:root>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="admin"
jcr:mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation"
jcr:primaryType="oak:Resource"/>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
jcr:primaryType="sling:OrderedFolder">
<slide_1.pptx/>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:dam="http://www.day.com/dam/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
jcr:mixinTypes="[mix:referenceable]"
jcr:primaryType="dam:Asset"
jcr:uuid="fda7b727-e202-4261-b234-387ccd7d86d9">
<jcr:content
dam:assetState="unProcessed"
jcr:primaryType="dam:AssetContent">
<metadata
jcr:mixinTypes="[cq:Taggable]"
jcr:primaryType="nt:unstructured"/>
<related jcr:primaryType="nt:unstructured"/>
</jcr:content>
</jcr:root>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
jcr:primaryType="nt:file">
<jcr:content
jcr:lastModifiedBy="workflow-process-service"
jcr:mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation"
jcr:primaryType="oak:Resource"/>
</jcr:root>

0 comments on commit 5e843b2

Please sign in to comment.