sdhoover/LookR — pull request #1 by robertzk (2014-07-24 21:40:36+00:00)
Title: fix incorrect sorting order

There is an issue with sorting filters when signing a string. In `LookerQuery`, we have something like this:

```R
if(any(is.na(filters))){
Looker$filters <- NA
} else {
Looker$filters <- sort(filters)
}
```

which is causing a pernicious issue. If one key is a proper substring of another, this will cause the signature to not match what the backend Looker API is expecting. Namely, we ran into the following scenario:

```r
filters <- c('loans.paid_off: Yes', 'loans.paid_off_date: before 3 months ago')
```

The correct sorting order is `c('loans.paid_off', 'loans.paid_off_date')`, but the above will instead compare `loans.paid_off: Yes` to `loans.paid_off_date: before 3 months ago`, resulting in the lexicographical comparison of `"loans.paid_off:"` and `"loans.paid_off_"`. Since `':' > '_'` due to ASCII ordinality, this will swap these two keys and result in an incorrectly signed signature.

The solution is to sort by first splitting on the `:`, since we are really trying to sort `c('loans.paid_off', 'loans.paid_off_date')`, not `c('loans.paid_off: Yes', 'loans.paid_off_date: before 3 months ago')`