diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-10-23 10:49:18 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-10-23 10:49:18 +0000 |
commit | 6a12c6cb256c7054c656c657bd056be4a32b030b (patch) | |
tree | 349167447eea032cba2fcac8db994cb6c9991400 /poi-ooxml | |
parent | 22bac58465b5187609a58a9eec0b5e7f537a1485 (diff) | |
download | poi-6a12c6cb256c7054c656c657bd056be4a32b030b.tar.gz poi-6a12c6cb256c7054c656c657bd056be4a32b030b.zip |
[bug-65650] use image/x-pict mime type
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894507 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
3 files changed, 54 insertions, 50 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ContentTypes.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ContentTypes.java index 1b90361d8c..bda08f6445 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ContentTypes.java +++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/ContentTypes.java @@ -97,7 +97,7 @@ public final class ContentTypes { * @see <a href="http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html"> * http://developer.apple.com/documentation/mac/QuickDraw/QuickDraw-2.html</a> */ - public static final String IMAGE_PICT = "image/pict"; + public static final String IMAGE_PICT = "image/x-pict"; public static final String EXTENSION_PICT = "pict"; diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java index a3989aa7e2..7c08964bd2 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRelation.java @@ -23,8 +23,11 @@ import java.util.Map; import org.apache.poi.ooxml.POIXMLDocument; import org.apache.poi.ooxml.POIXMLRelation; import org.apache.poi.openxml4j.opc.PackageRelationshipTypes; +import org.apache.poi.sl.usermodel.PictureData; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import static org.apache.poi.openxml4j.opc.PackageRelationshipTypes.IMAGE_PART; + public final class XWPFRelation extends POIXMLRelation { /** @@ -155,76 +158,76 @@ public final class XWPFRelation extends POIXMLRelation { * Supported image formats */ public static final XWPFRelation IMAGE_EMF = new XWPFRelation( - "image/x-emf", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.emf", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.EMF.contentType, + IMAGE_PART, + "/word/media/image#.emf", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_WMF = new XWPFRelation( - "image/x-wmf", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.wmf", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.WMF.contentType, + IMAGE_PART, + "/word/media/image#.wmf", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_PICT = new XWPFRelation( - "image/pict", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.pict", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.PICT.contentType, + IMAGE_PART, + "/word/media/image#.pict", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_JPEG = new XWPFRelation( - "image/jpeg", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.jpeg", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.JPEG.contentType, + IMAGE_PART, + "/word/media/image#.jpeg", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_PNG = new XWPFRelation( - "image/png", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.png", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.PNG.contentType, + IMAGE_PART, + "/word/media/image#.png", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_DIB = new XWPFRelation( - "image/dib", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.dib", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.DIB.contentType, + IMAGE_PART, + "/word/media/image#.dib", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_GIF = new XWPFRelation( - "image/gif", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.gif", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.GIF.contentType, + IMAGE_PART, + "/word/media/image#.gif", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_TIFF = new XWPFRelation( - "image/tiff", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.tiff", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.TIFF.contentType, + IMAGE_PART, + "/word/media/image#.tiff", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_EPS = new XWPFRelation( - "image/x-eps", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.eps", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.EPS.contentType, + IMAGE_PART, + "/word/media/image#.eps", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_BMP = new XWPFRelation( - "image/x-ms-bmp", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.bmp", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.BMP.contentType, + IMAGE_PART, + "/word/media/image#.bmp", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGE_WPG = new XWPFRelation( - "image/x-wpg", - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - "/word/media/image#.wpg", - XWPFPictureData::new, XWPFPictureData::new + PictureData.PictureType.WPG.contentType, + IMAGE_PART, + "/word/media/image#.wpg", + XWPFPictureData::new, XWPFPictureData::new ); public static final XWPFRelation IMAGES = new XWPFRelation( - null, - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", - null, - XWPFPictureData::new, XWPFPictureData::new + null, + IMAGE_PART, + null, + XWPFPictureData::new, XWPFPictureData::new ); private XWPFRelation(String type, String rel, String defaultName) { diff --git a/poi-ooxml/src/test/java/org/apache/poi/openxml4j/opc/TestRelationships.java b/poi-ooxml/src/test/java/org/apache/poi/openxml4j/opc/TestRelationships.java index ec82a36dd4..7fd655d4a1 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/openxml4j/opc/TestRelationships.java +++ b/poi-ooxml/src/test/java/org/apache/poi/openxml4j/opc/TestRelationships.java @@ -18,6 +18,7 @@ package org.apache.poi.openxml4j.opc; import static org.apache.poi.openxml4j.OpenXML4JTestDataSamples.openSampleStream; +import static org.apache.poi.openxml4j.opc.PackageRelationshipTypes.IMAGE_PART; import static org.apache.poi.openxml4j.opc.TestContentType.isOldXercesActive; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -316,7 +317,7 @@ class TestRelationships { assertEquals(6, drawingRels.size()); // expected one image - assertEquals(1, drawingPart.getRelationshipsByType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image").size()); + assertEquals(1, drawingPart.getRelationshipsByType(IMAGE_PART).size()); // and three hyperlinks assertEquals(5, drawingPart.getRelationshipsByType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink").size()); |