Treat a blank edition in a permanent link as no edition - #115
Merged
Conversation
Regression from #114, found while triaging website bugs filed against OpenIPC/firmware. A permanent link names every field whether or not it has a value, so `?...&rom=nor16m&var=&sd=sd` is what a link built from a camera with no edition chosen looks like -- and the menu produces exactly that, because allowedEditions falls back to '' for a chip with nothing published. OpenIPC/firmware#1912 carries a real one. `if params[key]` treats the empty string as an answer, so the edition became "" and the dropdown rendered with nothing selected at all. Before #114 this was unreachable: `show` read `ver`, which permalink never wrote, so an empty `var=` was simply ignored. Accepting `var` -- and emitting `ver` -- made both spellings live. `present?` instead. Blank in a query string means "not specified", so the constructor default stands, which is what it did before. JavaScript covers for it on load, since '' is not in the allowed list and checkFlashSize moves off it, and a browser submits the first option of a select with nothing marked. So this never produced wrong instructions -- but it rendered a form the visitor had to notice and correct, on a link the site generated itself. Two tests, one per spelling. Reverting to bare truthiness fails both. 21 rubocop offences in the touched files, unchanged from master. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YFg9PRy2T6cr983S8gran5
PR Summary by QodoIgnore blank edition values in permanent links
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt |
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.
Regression from #114, found while triaging website bugs filed against
OpenIPC/firmware.A permanent link names every field whether or not it has a value.
OpenIPC/firmware#1912carries a real one:
var=with nothing after it. The menu produces exactly that, becauseallowedEditionsfalls back to''for a chip with nothing published, and theform then posts an empty edition.
if params[key]treats""as an answer, sofirmware_versionbecame""andthe dropdown rendered with nothing selected:
Before #114 this was unreachable —
showreadver, whichpermalinkneverwrote, so an empty
var=was ignored and theliteconstructor default stood.Accepting
varand emittingvermade both spellings live. Mine.present?instead: blank in a query string means "not specified".Severity
Low, and worth stating rather than overselling.
checkFlashSize()runs on load,''is not in the allowed list, so JavaScript moves off it; and a browsersubmits the first option of a select with nothing marked selected. So this never
produced wrong flashing instructions. It rendered a form the visitor had to
notice and correct, reached from a link the site generated itself.
Verification
bin/rails test— 200 runs, 756 assertions, 0 failures (198 before).Reverting to bare truthiness fails both new tests. 21 rubocop offences in the
touched files, unchanged from master.
🤖 Generated with Claude Code
https://claude.ai/code/session_01YFg9PRy2T6cr983S8gran5