fix(admin-control-panel): use depth-aware awk for robust Adminer block removal - #219
Merged
Merged
Conversation
…al and improve div grep patterns Agent-Logs-Url: https://github.com/EngineScript/EngineScript/sessions/d696b39d-35bd-4593-8c93-5ec244db494d Co-authored-by: PDowney <11467177+PDowney@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix HTML extraction issue in admin control panel install script
fix(admin-control-panel): use depth-aware awk for robust Adminer block removal
Apr 30, 2026
Agent-Logs-Url: https://github.com/EngineScript/EngineScript/sessions/5611f46b-cdc1-477d-8739-4065b7ef5cf8 Co-authored-by: PDowney <11467177+PDowney@users.noreply.github.com>
Removed outdated entries for the admin control panel installation and robust Adminer block removal from the changelog.
PDowney
approved these changes
May 1, 2026
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Admin Control Panel install script to remove the Adminer card more robustly by replacing a fragile sed range delete with depth-aware awk parsing, and introduces a constant for the control panel index path.
Changes:
- Define
CONTROL_PANEL_INDEXand reuse it instead of repeating the full/var/www/admin/control-panel/index.htmlpath. - Replace Adminer card extraction/removal logic with depth-aware
awkto better handle nested<div>structures. - Tighten
<div>/</div>counting in the sanity check used to validate the extracted block.
Comment on lines
46
to
+48
| # Remove Adminer tool card if INSTALL_ADMINER=0 | ||
| if [[ "${INSTALL_ADMINER}" -eq 0 ]]; then | ||
| CONTROL_PANEL_INDEX="/var/www/admin/control-panel/index.html" |
Comment on lines
49
to
53
| # NOTE: This sed range depends on the HTML structure of index.html: | ||
| # - the Adminer card must be wrapped in a single <div ... id="adminer-tool" ...> ... </div> block | ||
| # - the opening <div> with id="adminer-tool" and its matching closing </div> must each be on a single line | ||
| # - the block must not contain nested <div> elements whose closing tags appear before the end of the card | ||
| # If this structure changes, update this command (or switch to an HTML-aware tool) to avoid partial removal. |
Comment on lines
+64
to
+71
| if (!in_block && line ~ /<div[^>]*id="adminer-tool"[^>]*>/) { | ||
| in_block=1 | ||
| } | ||
| if (in_block) { | ||
| print line | ||
| opens=gsub(/<div[^>]*>/, "&", line) | ||
| closes=gsub(/<\/div>/, "&", line) | ||
| depth += opens - closes |
Comment on lines
+86
to
+92
| if (!in_block && line ~ /<div[^>]*id="adminer-tool"[^>]*>/) { | ||
| in_block=1 | ||
| } | ||
| if (in_block) { | ||
| opens=gsub(/<div[^>]*>/, "&", line) | ||
| closes=gsub(/<\/div>/, "&", line) | ||
| depth += opens - closes |
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.



CONTROL_PANEL_INDEXconstant at the top of the Adminer removal block/var/www/admin/control-panel/index.htmlwith"${CONTROL_PANEL_INDEX}"Original prompt