oasis-open / cti-python-stix2

OASIS TC Open Repository: Python APIs for STIX 2
https://stix2.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
356 stars 113 forks source link

Unable to set pretty=false in FileSystemSink as it is hardcoded as true #561

Open himynamesdave opened 1 year ago

himynamesdave commented 1 year ago

Currently cannot set the parameter pretty=false using FileSystemSink endpoints.

In that code path - Pretty is hardcoded

with io.open(file_path, mode='w', encoding=encoding) as f:
            fp_serialize(stix_obj, f, pretty=True, encoding=encoding, ensure_ascii=False)

https://github.com/oasis-open/cti-python-stix2/blob/2743b90fc0afe45193863d3f43f69b5f95cda6a3/stix2/datastore/filesystem.py#L588

Other endpoints support this parameter and it is not clear why it is not supported by FileSystemSink

Hence suggestion is to allow boolean variable for pretty for this endpoint.

himynamesdave commented 8 months ago

Also linking the relevant discussion on CTI TC Slack for reference:

https://cti-tc.slack.com/archives/C0DR1QMM3/p1667743171800879