GlobalPathogenAnalysisService / gpas-cli

The CLI client for GPAS SC2
Other
5 stars 2 forks source link

HCELEC-411 Error not thrown when there is special character in the metadata file name #51

Closed KuzminaAnna closed 2 years ago

KuzminaAnna commented 2 years ago

Describe the problem/error: When there are special characters within metadata file name, error is not throwing when uploading the sample. Tested different samples, upload is either success or stuck.

Expected behavior: Since EC 1.0.8, directory/metadata file name only allows ./:_-, any other characters are not allowed and would error would throw. Expect the upload to throw error instead of successful upload or stuck.

Steps to Reproduce:

Upload a meatadata with special characters in the file name, such as "@`~?" through EC Expect the validation to throw error "The only special characters allowed are ./:_-". Actual the error did not throw, the upload process is either successful or stuck. System Identification: DEV Reproducible? Yes If multiple areas are impacted list areas: EC 1.0.9 integrated with gpas-cli 0.2.1

KuzminaAnna commented 2 years ago

Screen Shot 2022-07-08 at 11 03 12 AM

natesun1 commented 2 years ago

Please see the following screenshot with gpas-cli 0.2.1 Screen Shot 2022-07-08 at 11 24 08 AM

bede commented 2 years ago

Thanks for reporting, will investigate

bede commented 2 years ago

I have added a pre-validation check that raises a ValidationError if the path fails a regex:

    if not bool(re.match(r"^[A-Za-z0-9\\\s./_-]+$", str(upload_csv))):
        raise ValidationError(
            [{"error": "upload csv path contains illegal characters"}]
        )
deepakcherian06 commented 2 years ago

Is this fixed in gpas-cli version 0.2.2 ? I see the same issue for special character in directory name and sample filename as well