aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDanilo Segan <danilo@canonical.com>2012-08-22 20:38:19 +0200
committerDanilo Segan <danilo@canonical.com>2012-08-22 20:38:19 +0200
commitdc941e4316ab419e05056ed9e433108ea282b71f (patch)
tree68bdf4a89dd687446086b8aea543bbc6cd0605b7 /scripts
parent3556fc0aedf9ff695fcac8a9e6c9a289a59def52 (diff)
Complete sanitize_file.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/publish_to_snapshots.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/publish_to_snapshots.py b/scripts/publish_to_snapshots.py
index 21b25bb..ca5837d 100755
--- a/scripts/publish_to_snapshots.py
+++ b/scripts/publish_to_snapshots.py
@@ -64,8 +64,14 @@ class SnapshotsPublisher(object):
def sanitize_file(cls, file_path):
"""This truncates the file and fills it with its own filename."""
assert not cls.is_accepted_for_staging(file_path)
+ base_file_name = os.path.basename(file_path)
protected_file = open(file_path, "w")
+ # Nice property of this is that we are also saving on disk space
+ # needed.
protected_file.truncate()
+ # To help distinguish files more easily when they are downloaded,
+ # we write out the base file name as the contents.
+ protected_file.write(base_file_name)
protected_file.close()
def validate_args(self, args):