Skip to content

Commit

Permalink
fix for whitespace in label values (#497)
Browse files Browse the repository at this point in the history
* added URL decoding to UI and cromwell shim layer
* added support for whitespaces in label keys and values
  • Loading branch information
rsasch authored Oct 23, 2018
1 parent b02188e commit 34400b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions servers/cromwell/jobs/controllers/jobs_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from jobs.models.update_job_labels_request import UpdateJobLabelsRequest
from jobs.controllers.utils import job_statuses
from jobs.controllers.utils import task_statuses
import urllib

_DEFAULT_PAGE_SIZE = 64

Expand Down Expand Up @@ -246,6 +247,7 @@ def query_jobs(body, **kwargs):
auth = kwargs.get('auth')
headers = kwargs.get('auth_headers')
query = QueryJobsRequest.from_dict(body)
query.labels = _format_query_labels(query.labels)
query_page_size = query.page_size or _DEFAULT_PAGE_SIZE
offset = 0
if query.page_token is not None:
Expand Down Expand Up @@ -367,3 +369,12 @@ def _parse_datetime(date_string):

def _get_base_url():
return current_app.config['cromwell_url']


def _format_query_labels(orig_query_labels):
if orig_query_labels is None:
return None
query_labels = {}
for key, val in orig_query_labels.items():
query_labels[urllib.unquote(key)] = urllib.unquote(val)
return query_labels
2 changes: 1 addition & 1 deletion ui/src/app/shared/utils/url-search-params.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import {TimeFrame} from "../model/TimeFrame";
let chips: Map<string, string> = new Map();
urlSearchParams.paramsMap.forEach((values: string[], key: string) => {
if (values && key) {
chips.set(key, values.toString());
chips.set(decodeURIComponent(key), decodeURIComponent(values.toString()));
}
});
return chips;
Expand Down

0 comments on commit 34400b9

Please sign in to comment.