-
-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
XWIKI-20715: Don't use user-provided filenames in office import
* Add a method to DocumentAccessBridge for setting the attachment content from an input stream * Apply some basic cleaning to filenames in OfficeConverterFileStorage * Use fixed filenames for input/output in the office importer and only keep the extension. * Introduce an interface OfficeDocumentArtifact to represent artifacts with two implementations that are backed by a file or a byte array, respectively. * Provide a map between true filename and the OfficeDocumentArtifact instead of just a set of files in the conversion result. * Adapt code using the changed APIs and tests. * Deprecate methods that used the `Set<File>` API for artifacts and move them to legacy. * Replace the static prefix on images by the name of the input file. * Add a test for the image prefix replacement. * Use a real XHTMLMarkerResourceReferenceSerializer in ImageFilterTest as it simplifies the tests (and adds just a single class as dependency).
- Loading branch information
Showing
33 changed files
with
836 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...fice-importer/src/main/java/org/xwiki/officeimporter/document/OfficeDocumentArtifact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.xwiki.officeimporter.document; | ||
|
||
import java.io.InputStream; | ||
|
||
import org.xwiki.officeimporter.OfficeImporterException; | ||
import org.xwiki.stability.Unstable; | ||
|
||
/** | ||
* An artifact for an office document. | ||
* | ||
* @version $Id$ | ||
* @since 14.10.8 | ||
* @since 15.3RC1 | ||
*/ | ||
@Unstable | ||
public interface OfficeDocumentArtifact | ||
{ | ||
/** | ||
* @return the name of the artifact | ||
*/ | ||
String getName(); | ||
|
||
/** | ||
* @return an input stream for reading the artifact's content | ||
*/ | ||
InputStream getContentInputStream() throws OfficeImporterException; | ||
} |
Oops, something went wrong.