Skip to content

Don't double-eval quoted params (fixes #13)#15

Merged
vokimon merged 2 commits into
vokimon:masterfrom
GiovanH:fix-double-eval
Dec 11, 2025
Merged

Don't double-eval quoted params (fixes #13)#15
vokimon merged 2 commits into
vokimon:masterfrom
GiovanH:fix-double-eval

Conversation

@GiovanH

@GiovanH GiovanH commented Jul 19, 2025

Copy link
Copy Markdown
Contributor

Because the code redefines param, without the elif here this block can run on an empty param string, incorrectly running eval twice:

            elif param[0] == param[-1] == "'":
                param = eval(param)

This patch fixes the bug.

@vokimon

vokimon commented Oct 26, 2025

Copy link
Copy Markdown
Owner

Could you, please, propose a unit test to illustrate the test case?

@GiovanH

GiovanH commented Nov 8, 2025

Copy link
Copy Markdown
Contributor Author

I didn't realize you were running test cases. It looks like many of the test cases here are already failing:

---------- coverage: platform win32, python 3.11.9-final-0 -----------
Name                                Stmts   Miss Branch BrPart  Cover
---------------------------------------------------------------------
customblocks\__init__.py                1      0      0      0   100%
customblocks\customblocks.py          141      0     58      0   100%
customblocks\entrypoints.py            21      8     10      2    55%
customblocks\generators.py            144     19     36      1    88%
customblocks\testutils.py              26      0      0      0   100%
customblocks\utils\__init__.py          3      0      0      0   100%
customblocks\utils\fetcher.py          50      0     20      0   100%
customblocks\utils\hyperscript.py      45      0     26      0   100%
customblocks\utils\image.py            44      4      8      2    88%
customblocks\utils\pageinfo.py         70      3     16      0    92%
---------------------------------------------------------------------
TOTAL                                 545     34    174      5    93%

Let me see about adding a new case to cover this fix.

@GiovanH

GiovanH commented Nov 8, 2025

Copy link
Copy Markdown
Contributor Author

I have pushed exactly the error case I described in #13 as a test case. It fails in 1.5.3 but passes with this fix.

@vokimon

vokimon commented Dec 8, 2025

Copy link
Copy Markdown
Owner

Now, all tests are passing in master. Could you rebase your branch?

@GiovanH

GiovanH commented Dec 11, 2025

Copy link
Copy Markdown
Contributor Author

You should have full permission to push changes to this branch, but I will run a rebase.

@vokimon vokimon merged commit b4b9a92 into vokimon:master Dec 11, 2025
1 of 5 checks passed
@vokimon

vokimon commented Dec 11, 2025

Copy link
Copy Markdown
Owner

The error is another fragile test of mine depending on external services. Let's merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants