If a user copies/pastes the Clicky ID into the inputs and accidentally leaves a leading or trailing space, the HTML output will have errors. (broken link)

I think that a fix is to add a trim() function on line 95. I'll see if I can post a patch here in a moment.

To replicate:
Paste a Clicky ID into the admin area with a leading space. Then check the HTML output.

Edit: the attached patch is for branch 7.x-1.x.

CommentFileSizeAuthor
#3 trim_site_id_number-2666704.patch505 bytesZ2222

Comments

J. Cohen created an issue. See original summary.

Z2222’s picture

Issue summary: View changes
Z2222’s picture

Issue summary: View changes
StatusFileSize
new505 bytes
rsvelko’s picture

even better make that trimming on settings page save. Which I did in a fresh commit:
4fe5491 2016-02-21 15:13:46

Just in case adding the trim() function also in the way you propose to avoid invalid html in already filled in settings forms...
Also will write an update hook that will trim the field variable on running the update.

rsvelko’s picture

Status: Active » Fixed

pasting git log --oneline where u can see all trim-ing has been done everywhere.
4fe5491 2016-02-21 15:13:46 +0100 M getclicky.admin.inc: - renamed form builder function getclicky_admin_settings() -> getclicky_admin_settings_form() - added getclicky_admin_settings_form_validate() that validates the site_id number for ! empty and is_numeric - minor: added note next to site key field 'Site Key Number (Optional: needed for displaying stats here in getclicky's drupal admin area.' - minor: replaced all
to

d95071b 2016-02-21 15:22:32 +0100 M getclicky.module: trim site id and key numbers just in case; admin page trimming on save already implemented
349e907 2016-02-21 15:49:21 +0100 M getclicky.install: update hook for trimming
6cb961e 2016-02-21 15:53:52 +0100 M getclicky.install: put update hook descriptions in the right place
cf6279e 2016-02-21 15:55:54 +0100 m
32d1c8e 2016-02-21 15:59:59 +0100 M getclicky.admin.inc: trim and validate the optional site key number too
d83fb5b 2016-02-21 16:03:08 +0100 (HEAD, origin/HEAD, origin/7.x-1.x, 7.x-1.x) M getclicky.admin.inc: dont validate site key string, just trim is enough

m = minor whitespace change

Z2222’s picture

I was thinking that existing sites that have accidentally put the wrong info in might need it trimmed on variable get, or maybe just a message letting them know that their existing key has whitespace. I had a site like that for a long time before I noticed it recently.

rsvelko’s picture

I see/saw ur point yesterday and
I made it trim both on settings-save and on variable_get stage.
The new 7.x-1.2 release comes with an updatee_hook, that will trim too when run.

You can safely git pull or use the new 1.2 release. Cheers.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.