Repository navigation
Sheet: a model encoding that survives header trimming - #60
Merged
Merged
Conversation
The model travels in the X-Model header. An empty sheet encoded as `B2<tab>`; browsers drop whitespace at the ends of a header value, so the next step sent `B2`, which did not decode, and the page fell back to the initial model (the selection jumped back to A1). A value ending in a space, or holding `;`, `|` or a tab, broke the same way. Each part is now percent-encoded, with `/`, `,` and `:` as separators, so the line never starts or ends with whitespace and any value round trips. pure_spec checks both cases after trimming, and that the line has no whitespace at its ends; all three fail with the old codec.
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.
Problem
The Sheet example sends its model in the
X-Modelheader and gets it back on the next step. An empty sheet with B2 selected encoded asB2<tab>. Browsers drop whitespace at either end of a header value, so the next step sentB2, whichdecodeModelrejected, and the page fell back to the initial model: the value went into the right cell, but the selection jumped back to A1. A cell value ending in a space, or holding;,|or a tab, broke the same way. This was found from the aether side.Change
encodeModelanddecodeModelpercent-encode each part withLeanTea.Auth.urlEncode, which leaves only letters, digits,-_.~and%xx./after the selected cell,,between cells and:inside a cell. Encoded text never contains them, so the line never starts or ends with whitespace and any value round-trips.Tests
pure_spechas a new "Sheet model codec" group (3 checks), run on the encoded line after trimming it as a browser would:%and+round-trip;All three fail against the old codec, and
pure_specpasses with the fix: 49 passed, 0 failed.sheet_servebuilds.