Closed Bug 1553707 Opened 6 years ago Closed 6 years ago

Support calling API methods with literal `/` in URL parameters

Categories

(Taskcluster :: Services, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dustin, Unassigned, Mentored)

Details

We have a bunch of API methods that take URL parameters that might contain slashes. Currently, we require that those be escaped, e.g., /api/worker-manager/v1/worker-type/some-provisioner%7Esome-worker-type. But at least when that URL parameter is the last one in the URL, we should not require users to perform that escaping.

I played around with this a little. I learned that

  • Taskcluster-lib-api doesn't do its own parsing of :param in API method routes - it leaves that to Express
  • Express uses path-to-regexp to handle this
  • Express 4 uses an old, terrible version of path-to-regexp that doesn't support syntaxes like :param(.*) (I tried, and this issue suggests that there are other issues, too))

So, it seems that we should wait until Express 5 is released and we've upgraded to it, then implement this.

cc:owlish, since we were talking about this today.

Note that this would be a nice fix for queue.getLatestArtifact too. That has route /task/<taskId>/artifacts/<name> and typically <name> has slashes in it, which must be escaped. It'd be nice to our users if we let them provide un-escaped names, too.

It was already the case for getLatestArtifact, This is done now.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.