-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: strip leading and trailing whitespace from QR Code data #10332
Conversation
Hey @michaelsbradleyjr, and thank you so much for making your first pull request in status-react! ❤️ Please help us make your experience better by filling out this brief questionnaire https://goo.gl/forms/uWqNcVpVz7OIopXg2 |
Pull Request Checklist
|
Jenkins Builds
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string functions are not null safe
@@ -34,4 +35,4 @@ | |||
(reagent/create-element default-camera (clj->js (merge {:inverted true} props)))) | |||
|
|||
(defn get-qr-code-data [code] | |||
(.-data code)) | |||
(string/trim (.-data code))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(string/trim (.-data code))) | |
(when (.-data code) (string/trim (.-data code)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated in both places to use when-let
, which carries an assumption (I think) that nil
is okay to pass on even if (.-data code)
or @text-value
was false
. Is it acceptable?
7c65ebe
to
63ba52a
Compare
99% of end-end tests have passed
Failed tests (1)Click to expand
Passed tests (90)Click to expand |
Checked from:
In all places, whitespaces are trimmed. |
All leading and trailing whitespace is now removed from strings derived from QR codes, both in the case of `get-qr-code-data` (real camera) and `qr-test-view` (mock camera). Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
63ba52a
to
0a9919c
Compare
fixes #10306.
see also #10280 (comment).
Summary
All leading and trailing whitespace is now removed from strings derived from QR codes, both in the case of
get-qr-code-data
(real camera) andqr-test-view
(mock camera).Platforms
Areas that maybe impacted
Functional
Steps to test
qrencode
(brew install qrencode
).+
in the top-right of the screen.QR_READ_TEST_MENU
flag in your development setup, either enter some text that has leading/trailing whitespace, or take a picture of the QR code you generated in the first step.status: ready