File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636
3737from securesystemslib .signer import Signature , Signer
3838from securesystemslib .storage import FilesystemBackend , StorageBackendInterface
39- from securesystemslib .util import persist_temp_file
4039
4140# Expose payload classes via ``tuf.api.metadata`` to maintain the API,
4241# even if they are unused in the local scope.
@@ -332,11 +331,14 @@ def to_file(
332331 StorageError: The file cannot be written.
333332 """
334333
334+ if storage_backend is None :
335+ storage_backend = FilesystemBackend ()
336+
335337 bytes_data = self .to_bytes (serializer )
336338
337339 with tempfile .TemporaryFile () as temp_file :
338340 temp_file .write (bytes_data )
339- persist_temp_file (temp_file , filename , storage_backend )
341+ storage_backend . put (temp_file , filename )
340342
341343 # Signatures.
342344 def sign (
You can’t perform that action at this time.
0 commit comments