Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
Keep using the canonical version number for cloud storage uploads.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Nov 9, 2013
1 parent 69e575e commit 9933c2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/models/package_version.py
Expand Up @@ -203,7 +203,11 @@ def example_version_constraint(self):
@property
def storage_path(self):
"""The Cloud Storage path for this package."""
return 'packages/%s-%s.tar.gz' % (self.package.name, self.version)
# Use the canonical version for the cloud storage path for
# backwards-compatibility with package versions that were uploaded
# prior to storing non-canonicalized versions.
return 'packages/%s-%s.tar.gz' % \
(self.package.name, self.version.canonical)

@property
def dartdoc_storage_path(self):
Expand Down
2 changes: 1 addition & 1 deletion test/test_handlers/test_package_versions.py
Expand Up @@ -197,7 +197,7 @@ def test_package_versions_are_indexed_by_canonical_version(self):
self.assertEqual(response.status_int, 302)
self.assertEqual(response.headers['Location'],
'http://localhost:80/gs_/packages/' +
'test-package-03.04.05.tar.gz')
'test-package-3.4.5.tar.gz')

def post_package_version(self, version, name='test-package'):
response = self.create_package(self.upload_archive(name, version))
Expand Down

0 comments on commit 9933c2f

Please sign in to comment.