From 6207d62db3b67ae43374fdde9653948dfd206d12 Mon Sep 17 00:00:00 2001 From: vladdd Date: Mon, 24 Feb 2014 23:08:29 -0500 Subject: [PATCH] Update repository_tool.py. Properly strip (again) the digest prepended to 'digest.filename' files. The required '+1' appears to have been accidentally deleted in a recent commit: https://github.com/theupdateframework/tuf/commit/298f52ddb8a6c017e4892a2f1de6545f7715de59#diff-59d384d80d746c800b16c8387756c0ccL2750 Thanks to Santiago for locating the bug. --- tuf/repository_tool.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tuf/repository_tool.py b/tuf/repository_tool.py index 50bd9b78..8800c872 100755 --- a/tuf/repository_tool.py +++ b/tuf/repository_tool.py @@ -2817,7 +2817,10 @@ def _strip_consistent_snapshot_digest(metadata_filename, consistent_snapshot): if consistent_snapshot: dirname, basename = os.path.split(metadata_filename) embeded_digest = basename[:basename.find('.')] - basename = basename[basename.find('.'):] + + # Ensure the digest, including the period, is stripped. + basename = basename[basename.find('.')+1:] + metadata_filename = os.path.join(dirname, basename) @@ -4336,6 +4339,10 @@ def write_metadata_file(metadata, filename, compressions, consistent_snapshot): Specify the algorithms, as a list of strings, used to compress the file; The only currently available compression option is 'gz' (gzip). + consistent_snapshot: + Boolean that determines whether the metadata file's digest should be + prepended to the filename. + tuf.FormatError, if the arguments are improperly formatted.