[FW][FIX] tools: fix PdfFileReader overwrite#188181
Closed
fw-bot wants to merge 2 commits intoodoo:saas-17.2from
Closed
[FW][FIX] tools: fix PdfFileReader overwrite#188181fw-bot wants to merge 2 commits intoodoo:saas-17.2from
fw-bot wants to merge 2 commits intoodoo:saas-17.2from
Conversation
In odoo#183165 the override of the PdfReader constructor was forcing the `strict` parameter to True [1] in the pdf shim for PyPDF2 1.x. So, when a PdfReader is instanciated with strict set to False, with that PyPDF version installed, the strict parameter is not taken into account. In that case, it impossible to upload some PDF documents that were allowed before the shims. With this commit, the override of the constructor is removed in the 1.x shim and the PdfReader override is only made once at the upper level. The `strict` parameter is defaulting to True but not enforced as it was the default behavior in PyPDF2 1.x. It should be changed later to follow the behavior of PyPDF2 >= 2.x. Also, any other parameter of the constructor are discarded as they are useless in PyPDF 1.x and not compatible at all with PyPDF >= 2.x. On the other hand, the new `password` parameter of 2.x is not backward compatible. [1](odoo/odoo@f03a12c/odoo/tools/pdf/_pypdf2_1.py#L19) X-original-commit: fd67b56
X-original-commit: fd67b56
Contributor
Contributor
Author
|
This PR targets saas-17.2 and is part of the forward-port chain. Further PRs will be created up to master. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
Contributor
Author
|
@d-fence @xmo-odoo the next pull request (#188195) is in conflict. You can merge the chain up to here by saying
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
Contributor
|
@robodoo r+ |
robodoo
added a commit
that referenced
this pull request
Nov 22, 2024
In #183165 the override of the PdfReader constructor was forcing the `strict` parameter to True[1][1] in the pdf shim for PyPDF2 1.x. So, when a PdfReader is instanciated with strict set to False, with that PyPDF version installed, the strict parameter is not taken into account. In that case, it impossible to upload some PDF documents that were allowed before the shims. With this commit, the override of the constructor is removed in the 1.x shim and the PdfReader override is only made once at the upper level. The `strict` parameter is defaulting to True but not enforced as it was the default behavior in PyPDF2 1.x. It should be changed later to follow the behavior of PyPDF2 >= 2.x. Also, any other parameter of the constructor are discarded as they are useless in PyPDF 1.x and not compatible at all with PyPDF >= 2.x. On the other hand, the new `password` parameter of 2.x is not backward compatible. [1]: f03a12c/odoo/tools/pdf/_pypdf2_1.py#L19 closes #188181 Forward-port-of: #187900 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com> Signed-off-by: Christophe Monniez (moc) <moc@odoo.com> Co-authored-by: Christophe Monniez <moc@odoo.com> Co-authored-by: xmo-odoo <xmo@odoo.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

In #183165 the override of the PdfReader constructor was forcing the
strictparameter to True1 in the pdf shim for PyPDF2 1.x.So, when a PdfReader is instanciated with strict set to False, with that PyPDF version installed, the strict parameter is not taken into account. In that case, it impossible to upload some PDF documents that were allowed before the shims.
With this commit, the override of the constructor is removed in the 1.x shim and the PdfReader override is only made once at the upper level. The
strictparameter is defaulting to True but not enforced as it was the default behavior in PyPDF2 1.x. It should be changed later to follow the behavior of PyPDF2 >= 2.x.Also, any other parameter of the constructor are discarded as they are useless in PyPDF 1.x and not compatible at all with PyPDF >= 2.x. On the other hand, the new
passwordparameter of 2.x is not backward compatible.Forward-Port-Of: #187900