Skip to content

Commit 765cc52

Browse files
committed
Run landing request state through validator
1 parent c3390f7 commit 765cc52

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lib/galaxy/managers/landing.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
)
3131
from galaxy.security.idencoding import IdEncodingHelper
3232
from galaxy.structured_app import StructuredApp
33+
from galaxy.tool_util_models.parameters import DataOrCollectionRequestAdapter
3334
from galaxy.util import safe_str_cmp
3435
from .context import ProvidesUserContext
3536

@@ -73,11 +74,22 @@ def create_workflow_landing_request(self, payload: CreateWorkflowLandingRequestP
7374
model.workflow_source = payload.workflow_id
7475
model.uuid = uuid4()
7576
model.client_secret = payload.client_secret
76-
model.request_state = payload.request_state
77+
model.request_state = self.validate_workflow_request_state(payload.request_state)
7778
model.public = payload.public
7879
self._save(model)
7980
return self._workflow_response(model)
8081

82+
def validate_workflow_request_state(self, request_state: dict) -> dict:
83+
# This would ideally be run in the context of a workflow input definition
84+
for key, value in request_state.items():
85+
if isinstance(value, dict):
86+
try:
87+
# persist values after model validators and aliases have been applied
88+
request_state[key] = DataOrCollectionRequestAdapter.validate_python(value)
89+
except Exception:
90+
pass
91+
return request_state
92+
8193
def claim_tool_landing_request(
8294
self, trans: ProvidesUserContext, uuid: UUID4, claim: Optional[ClaimLandingPayload]
8395
) -> ToolLandingRequest:

0 commit comments

Comments
 (0)