Make sure the TAR import system handles TAR paths with local directory references

This commit is contained in:
Joseph Schorr 2014-04-01 13:00:26 -04:00
parent 35f69b9f5b
commit 4f1ae25128
4 changed files with 27 additions and 3 deletions

View file

@ -20,7 +20,8 @@ def get_authenticated_user():
set_authenticated_user(loaded)
user = loaded
logger.debug('Returning authenticated user: %s', user.username)
if user:
logger.debug('Returning authenticated user: %s', user.username)
return user

View file

@ -355,6 +355,12 @@ def populate_database():
build2.uuid = 'deadpork-dead-pork-dead-porkdeadpork'
build2.save()
build3 = model.create_repository_build(building, token, job_config,
'f49d07f9-93da-474d-ad5f-c852107c3892',
'build-name', trigger)
build3.uuid = 'deadduck-dead-duck-dead-duckdeadduck'
build3.save()
org = model.create_organization('buynlarge', 'quay@devtable.com',
new_user_1)
org.stripe_id = TEST_STRIPE_ID

View file

@ -225,6 +225,19 @@ quayApp = angular.module('quay', ['ngRoute', 'chieffancypants.loadingBar', 'angu
};
dataFileService.tryAsTarGz_ = function(buf, success, failure) {
var collapsePath = function(originalPath) {
// Tar files can contain entries of the form './', so we need to collapse
// those paths down.
var parts = originalPath.split('/');
for (var i = parts.length - 1; i >= 0; i--) {
var part = parts[i];
if (part == '.') {
parts.splice(i, 1);
}
}
return parts.join('/');
};
var gunzip = new Zlib.Gunzip(buf);
var plain = gunzip.decompress();
@ -239,9 +252,13 @@ quayApp = angular.module('quay', ['ngRoute', 'chieffancypants.loadingBar', 'angu
var files = [];
for (var i = 0; i < handler.files.length; ++i) {
var currentFile = handler.files[i];
var path = collapsePath(currentFile.filename);
if (path == '') { continue; }
files.push({
'name': dataFileService.getName_(currentFile.filename),
'path': currentFile.filename,
'name': dataFileService.getName_(path),
'path': path,
'canRead': true,
'toBlob': (function(currentFile) {
return function() {

Binary file not shown.