Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWIKI-22335: Cannot import a ppt with LibreOffice 24.2.5 #3517

Merged
merged 8 commits into from
Sep 26, 2024

Conversation

michitux
Copy link
Contributor

@michitux michitux commented Sep 26, 2024

Jira URL

https://jira.xwiki.org/browse/XWIKI-22335

Changes

Description

  • Convert to PDF and extract images from the PDF
  • Adapt the unit test
  • Add new configuration options to configure format and quality

Still open:

  • Add a unit test for the configuration loader, verifying in particular that the fallback is correctly working.
  • Check the names of the new configuration options and add them to the configuration file template.

Clarifications

  • LibreOffice dropped support for direct export to images
  • Exporting to PDF and then converting the PDF to images using the existing dependency PDFBox dependency seems like the most backwards-compatible

Screenshots & Video

No UI changes.

Executed Tests

LANG=C.UTF-8 mvn clean install -Pdocker,legacy,integration-tests,snapshotModules,distribution,flavor-integration-tests -pl $(git diff --name-only --merge-base origin/master | awk -F'/' '{for(i=NF-1; i>0; i--){if($i ~ /src$/){printf(":%s\n", $(i-1)); break;}}}' | sort -u | paste -sd "," -),:xwiki-platform-office-test-docker

Note: The test coverage is currently too low as the code for the configuration loading still needs a unit test.

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • stable-16.4.x
    • stable-15.10.x

* Convert to PDF and extract images from the PDF
* Adapt the unit test
* Change the output format to PNG
* Change the default image format back to JPEG.
* Read the old office converter configuration for size and quality.
* Add new configuration options for format, quality and image size.
@surli surli added backport stable-15.10.x Used for automatic backport to 15.10.x branch. backport stable-16.4.x labels Sep 26, 2024
  * Fix existing comments in DefaultPresentationBuilder
  * Provide new properties in xwiki.properties
  * Fallback in document-formats.js in case custom-document-formats is
    not used for backward compatibility
  * Provide unit test
@surli surli marked this pull request as ready for review September 26, 2024 12:15
@@ -410,9 +410,8 @@ private GenericContainer<?> createServletContainer() throws Exception
// https://downloadarchive.documentfoundation.org/libreoffice/old so that we can benefit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems the comment is not accurate anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is accurate, the full comment is:

Note: we use https://download.documentfoundation.org/libreoffice/stable/ and not https://downloadarchive.documentfoundation.org/libreoffice/old so that we can benefit [...]

You might have missed the beginning on the line above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it was not accurate before :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I didn't change the comment when I changed it to use 7.6 with the old url.

  * Fix version of office in pom.xml
  * Improve a bit ServletContainerExecutor to have better understanding
    in case of error when building LO image
@surli surli merged commit acd6ed3 into xwiki:master Sep 26, 2024
1 check passed
Copy link

The backport to stable-15.10.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-stable-15.10.x stable-15.10.x
# Navigate to the new working tree
cd .worktrees/backport-stable-15.10.x
# Create a new branch
git switch --create backport-3517-to-stable-15.10.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 acd6ed3f38a03ee66b721e56093decb3cec1b4b6
# Push it to GitHub
git push --set-upstream origin backport-3517-to-stable-15.10.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-stable-15.10.x

Then, create a pull request where the base branch is stable-15.10.x and the compare/head branch is backport-3517-to-stable-15.10.x.

Copy link

The backport to stable-16.4.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-stable-16.4.x stable-16.4.x
# Navigate to the new working tree
cd .worktrees/backport-stable-16.4.x
# Create a new branch
git switch --create backport-3517-to-stable-16.4.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 acd6ed3f38a03ee66b721e56093decb3cec1b4b6
# Push it to GitHub
git push --set-upstream origin backport-3517-to-stable-16.4.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-stable-16.4.x

Then, create a pull request where the base branch is stable-16.4.x and the compare/head branch is backport-3517-to-stable-16.4.x.

github-actions bot pushed a commit that referenced this pull request Sep 26, 2024
* Convert to PDF and extract images from the PDF
* Adapt the unit test
* Change the output format to PNG
* Change the default image format back to JPEG.
* Read the old office converter configuration for size and quality.
* Add new configuration options for format, quality and image size.
* Revert "[Misc] Force using old version of LO until XWIKI-22335 is done"
* Revert "[Misc] Revert LO upgrade because of XWIKI-22335"
* Fix existing comments in DefaultPresentationBuilder
* Provide new properties in xwiki.properties
* Fallback in document-formats.js in case custom-document-formats is
    not used for backward compatibility
* Provide unit test
* Improve a bit ServletContainerExecutor to have better understanding
    in case of error when building LO image

This reverts commit 29e4543.
This reverts commit f19ea82.
This reverts commit 32a20ae.

---------

Co-authored-by: Simon Urli <[email protected]>
(cherry picked from commit acd6ed3)
surli pushed a commit that referenced this pull request Sep 26, 2024
* Convert to PDF and extract images from the PDF
* Adapt the unit test
* Change the output format to PNG
* Change the default image format back to JPEG.
* Read the old office converter configuration for size and quality.
* Add new configuration options for format, quality and image size.
* Revert "[Misc] Force using old version of LO until XWIKI-22335 is done"
* Revert "[Misc] Revert LO upgrade because of XWIKI-22335"
* Fix existing comments in DefaultPresentationBuilder
* Provide new properties in xwiki.properties
* Fallback in document-formats.js in case custom-document-formats is
    not used for backward compatibility
* Provide unit test
* Improve a bit ServletContainerExecutor to have better understanding
    in case of error when building LO image

This reverts commit 29e4543.
This reverts commit f19ea82.
This reverts commit 32a20ae.

---------

Co-authored-by: Simon Urli <[email protected]>
(cherry picked from commit acd6ed3)
surli pushed a commit that referenced this pull request Sep 26, 2024
* Convert to PDF and extract images from the PDF
* Adapt the unit test
* Change the output format to PNG
* Change the default image format back to JPEG.
* Read the old office converter configuration for size and quality.
* Add new configuration options for format, quality and image size.
* Revert "[Misc] Force using old version of LO until XWIKI-22335 is done"
* Revert "[Misc] Revert LO upgrade because of XWIKI-22335"
* Fix existing comments in DefaultPresentationBuilder
* Provide new properties in xwiki.properties
* Fallback in document-formats.js in case custom-document-formats is
    not used for backward compatibility
* Provide unit test
* Improve a bit ServletContainerExecutor to have better understanding
    in case of error when building LO image

This reverts commit 29e4543.
This reverts commit f19ea82.
This reverts commit 32a20ae.

---------

Co-authored-by: Simon Urli <[email protected]>
(cherry picked from commit acd6ed3)
surli pushed a commit that referenced this pull request Sep 26, 2024
* Convert to PDF and extract images from the PDF
* Adapt the unit test
* Change the output format to PNG
* Change the default image format back to JPEG.
* Read the old office converter configuration for size and quality.
* Add new configuration options for format, quality and image size.
* Revert "[Misc] Force using old version of LO until XWIKI-22335 is done"
* Revert "[Misc] Revert LO upgrade because of XWIKI-22335"
* Fix existing comments in DefaultPresentationBuilder
* Provide new properties in xwiki.properties
* Fallback in document-formats.js in case custom-document-formats is
    not used for backward compatibility
* Provide unit test
* Improve a bit ServletContainerExecutor to have better understanding
    in case of error when building LO image

This reverts commit 29e4543.
This reverts commit f19ea82.
This reverts commit 32a20ae.

---------

Co-authored-by: Simon Urli <[email protected]>
(cherry picked from commit acd6ed3)
(cherry picked from commit 1e71121)
@michitux michitux deleted the XWIKI-22335 branch September 27, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants