Skip to content

bug: Dataset field allows empty string bypassing fallback in compression job submission #1854

@coderabbitai

Description

@coderabbitai

Description

When submitting a compression job through the web UI, if a user enters text in the Dataset input field and then removes it, an empty string "" can be sent to the backend. This bypasses the fallback logic that sets the dataset to the default value, resulting in 400 errors.

Current Behavior

The code currently checks only for undefined:

payload.dataset = ("undefined" === typeof values.dataset) ?
    CLP_DEFAULT_DATASET_NAME :
    values.dataset;

This allows an empty string to pass through without applying the fallback.

Expected Behavior

The validation should also check for empty strings and apply the same fallback override when values.dataset.length === 0.

Suggested Fix

payload.dataset = ("undefined" === typeof values.dataset || 0 === values.dataset.length) ?
    CLP_DEFAULT_DATASET_NAME :
    values.dataset;

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions