REST step save as attachment fails when File name has spaces, running on MID


Description

The OOB REST step with Save as attachment enabled fails when the file name has spaces. The REST call goes through MID server in this scenario.

 The REST step is running on MID server and when MID server tries to create attachment with the given name, the URI encoding does not work causing this issue. 

Steps to Reproduce

1. Configure REST step to run on MID
2. Check save response as attachment and enter a file name wirth spaces in it, ex: test 123.txt
3. Test and found the error
Invalid uri 'http://localhost:8080/api/now/v1/attachment/file?sysparm_mid_pool=&table_name=sys_user&table_sys_id=46d96f57a9fe198101947a9620895886&file_name=test 123.txt': Invalid query

Workaround

Workaround for this issue is to replace the spaces in the filename with %20.


Related Problem: PRB1424519