[Pcsclite-git-commit] [website] 01/01: Reader selection: do not fail for integers values

Ludovic Rousseau rousseau at moszumanska.debian.org
Sun Jul 3 18:45:23 UTC 2016


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository website.

commit 0eee26057a16a9055d8690bd81e7d5023552b4c6
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sun Jul 3 20:41:12 2016 +0200

    Reader selection: do not fail for integers values
    
    for the "any" filter: do not try to .toLocaleUpperCase() an integer
    value. This make the code fail with an exception.
---
 select_readers/js/main.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/select_readers/js/main.js b/select_readers/js/main.js
index 88d492c..beb1a6a 100644
--- a/select_readers/js/main.js
+++ b/select_readers/js/main.js
@@ -120,7 +120,7 @@ function update_list() {
 function match(filters, reader) {
     "use strict";
 
-    var a, b, i, l, f, field, value, field2, value2, relation, v, m, found;
+    var a, b, i, l, f, field, value, field2, value2, relation, v, m, found, isInt;
 
     for (f = 0; f < filters.length; f += 1) {
         field = filters[f][0];
@@ -137,6 +137,9 @@ function match(filters, reader) {
             }
             if (isNaN(value2)) {
                 value2 = value;
+                isInt = false;
+            } else {
+                isInt = true;
             }
 
             found = false;
@@ -148,7 +151,7 @@ function match(filters, reader) {
                             break;
                         }
                     } else {
-                        if (typeof reader[field2] === 'string') {
+                        if (typeof reader[field2] === 'string' && !isInt) {
                             a = reader[field2].toLocaleUpperCase();
                             b = value2.toLocaleUpperCase();
                             if (a.indexOf(b) > -1) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/website.git



More information about the Pcsclite-cvs-commit mailing list