Skip to content

Conversation

@labkey-klum
Copy link
Contributor

Rationale

  • Convert from controller first to path first LabKey URLs
  • Introduce labkey.buildURL to handle URL generation. This includes moving the folderPath validation into this method and out of the calling function. Leverage the httr library to generate the URL including any query parameters and URL encoding.
  • Refactor selectRows to consolidate parameter generation for both GET and POST methods
  • Update makeFilter to support generating filter lists using named elements. This is the format that the httr utilities can accept for URL params more readily. While we aren't making use of this variant in this update, the plan is to eventually migrate to this format by default in a future release of Rlabkey. Until then, we support both the legacy and newer formats for functions that consume the return value of makeFilter.

Related Pull Requests

LabKey/testAutomation#2857

…e both newer and legacy filter formats. Update remaining functions to use the new labkey.buildURL utility.
@labkey-klum labkey-klum self-assigned this Jan 22, 2026
@labkey-klum labkey-klum requested a review from cnathe January 22, 2026 23:00
Copy link
Contributor

@cnathe cnathe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving. I'm planning to pull down the changes now to do manual testing. I'll focus mainly on the selectRows colFilters as most of the other changes for the path first part and labkey.buildURL seem like they should be covered by the existing tests.

baseUrl=labkey.getBaseUrl(baseUrl)

## check required parameters
if (missing(baseUrl) || is.null(baseUrl) || missing(folderPath))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are also checking for missing baseUrl and folderPath in labkey.buildURL. however, here we also check for is.null on baseUrl. should that check also be happening in labkey.buildURL for the various params?

Comment on lines -54 to -56
if(schemaName==URLdecode(schemaName)) {schemaName <- URLencode(schemaName)}
if(queryName==URLdecode(queryName)) {queryName <- URLencode(queryName)}
if(is.null(lookupKey)==FALSE) {if(lookupKey==URLdecode(lookupKey)) lookupKey <- URLencode(lookupKey)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have to do this URLencode check anymore with the labkey.buildURL? excellent!

{
url <- parse_url("")
url$query <- filters[i]
myurl <- build_url(url)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build_url is the part that handles the encoding part now right?

@cnathe
Copy link
Contributor

cnathe commented Jan 26, 2026

Manual testing Issue with special character: @labkey-klum
I have a sample type with several columns that have special characters in their names (ex. "aa{aa}", "b b", "d/d", "f,./"). When I try to do a labkey.selectRows call for this sample type with the updated Rlabkey pacakge, I get errors for both the colSelect and the colFilter.

For colSelect="Name,aa{aa},b b,c,c,d/d,e\\e", I get the following error:

_> Error in makeDF(mydata, colSelect, showHidden, colNameOpt) :

The column "c" specified in the colSelect variable does not exist in the result set. Be sure you are using the column name for colNameOpt="fieldname" and the column label for colNameOpt="caption". See the documentation for more details._

I believe this is mainly from the column with name "c,c".

For colFilter=makeFilter(c("e\\e", "IN", "5;e"),c("f$Pf\" testing %22 also", "NOT_MISSING", "")), I get the following error:

_> Error in parseToList(colFilter, dataRegionName = "", urlDecode = TRUE) :

Argument parameters is incorrectly formatted, it needs to be a list of string value pairs delimited by '='_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants