Skip to content
Snippets Groups Projects
Commit 23d3d68f authored by vlorentz's avatar vlorentz
Browse files

vault: Rename downloaded files to replace ':' with '_' in SWHIDs

Both Firefox and Chromium replace ':' (with spaces and underscores respectively)
parent f324ac3a
No related branches found
No related tags found
No related merge requests found
......@@ -200,9 +200,9 @@ describe('Vault Cooking User Interface Tests', function() {
// Stub response to the vault API to simulate archive download
cy.intercept('GET', this.vaultFetchDirectoryUrl, {
fixture: `${this.directory}.tar.gz`,
fixture: `${this.directory.replace(/:/g, '_')}.tar.gz`,
headers: {
'Content-disposition': `attachment; filename=${this.directory}.tar.gz`,
'Content-disposition': `attachment; filename=${this.directory.replace(/:/g, '_')}.tar.gz`,
'Content-Type': 'application/gzip'
}
}).as('fetchCookedArchive');
......@@ -285,9 +285,9 @@ describe('Vault Cooking User Interface Tests', function() {
// Stub response to the vault API indicating to simulate archive download
cy.intercept({url: this.vaultFetchRevisionUrl}, {
fixture: `${this.revision}.git.tar`,
fixture: `${this.revision.replace(/:/g, '_')}.git.tar`,
headers: {
'Content-disposition': `attachment; filename=${this.revision}.git.tar`,
'Content-disposition': `attachment; filename=${this.revision.replace(/:/g, '_')}.git.tar`,
'Content-Type': 'application/gzip'
}
}).as('fetchCookedArchive');
......@@ -462,9 +462,9 @@ describe('Vault Cooking User Interface Tests', function() {
// Stub response to the vault API to simulate archive download
cy.intercept({url: this.vaultFetchDirectoryUrl}, {
fixture: `${this.directory}.tar.gz`,
fixture: `${this.directory.replace(/:/g, '_')}.tar.gz`,
headers: {
'Content-disposition': `attachment; filename=${this.directory}.tar.gz`,
'Content-disposition': `attachment; filename=${this.directory.replace(/:/g, '_')}.tar.gz`,
'Content-Type': 'application/gzip'
}
}).as('fetchCookedArchive');
......@@ -495,9 +495,9 @@ describe('Vault Cooking User Interface Tests', function() {
// Stub response to the vault API to simulate archive download
cy.intercept({url: this.vaultFetchRevisionUrl}, {
fixture: `${this.revision}.git.tar`,
fixture: `${this.revision.replace(/:/g, '_')}.git.tar`,
headers: {
'Content-disposition': `attachment; filename=${this.revision}.git.tar`,
'Content-disposition': `attachment; filename=${this.revision.replace(/:/g, '_')}.git.tar`,
'Content-Type': 'application/gzip'
}
}).as('fetchCookedArchive');
......
......@@ -84,7 +84,7 @@ def api_vault_cook_flat(request, swhid):
Then to extract the cooked directory in the current one, use::
$ tar xvf path/to/swh:1:*.tar.gz
$ tar xvf path/to/swh_1_*.tar.gz
:param string swhid: the object's SWHID
......@@ -189,7 +189,9 @@ def api_vault_fetch_flat(request, swhid):
)
fname = "{}.tar.gz".format(swhid)
response = HttpResponse(res, content_type="application/gzip")
response["Content-disposition"] = "attachment; filename={}".format(fname)
response["Content-disposition"] = "attachment; filename={}".format(
fname.replace(":", "_")
)
return response
......@@ -246,7 +248,7 @@ def api_vault_cook_gitfast(request, swhid):
Then to import the revision in the current directory, use::
$ git init
$ zcat path/to/swh:1:rev:*.gitfast.gz | git fast-import
$ zcat path/to/swh_1_rev_*.gitfast.gz | git fast-import
$ git checkout HEAD
:param string swhid: the revision's permanent identifiers
......@@ -351,7 +353,9 @@ def api_vault_fetch_revision_gitfast(request, swhid):
)
fname = "{}.gitfast.gz".format(swhid)
response = HttpResponse(res, content_type="application/gzip")
response["Content-disposition"] = "attachment; filename={}".format(fname)
response["Content-disposition"] = "attachment; filename={}".format(
fname.replace(":", "_")
)
return response
......@@ -404,7 +408,7 @@ def api_vault_cook_git_bare(request, swhid):
Then to import the revision in the current directory, use::
$ tar -xf path/to/swh:1:rev:*.git.tar
$ tar -xf path/to/swh_1_rev_*.git.tar
$ git clone swh:1:rev:*.git new_repository
(replace ``swh:1:rev:*`` with the SWHID of the requested revision)
......@@ -486,5 +490,7 @@ def api_vault_fetch_revision_git_bare(request, swhid):
)
fname = "{}.git.tar".format(swhid)
response = HttpResponse(res, content_type="application/gzip")
response["Content-disposition"] = "attachment; filename={}".format(fname)
response["Content-disposition"] = "attachment; filename={}".format(
fname.replace(":", "_")
)
return response
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment