Comparing version 0.7.7 to 0.7.8
@@ -159,3 +159,3 @@ 'use strict'; | ||
} | ||
return fs.outputFileAsync(blobPath, body, { encoding: blob.httpProps['Content-Encoding'] }) | ||
return fs.outputFileAsync(this._escapeBlobDelimiter(blobPath), body, { encoding: blob.httpProps['Content-Encoding'] }) | ||
.then(() => { | ||
@@ -200,3 +200,3 @@ return response; | ||
coll.update(updateBlob); | ||
return fs.appendFileAsync(blobPath, body, { encoding: updateBlob.httpProps['Content-Encoding'] }) | ||
return fs.appendFileAsync(this._escapeBlobDelimiter(blobPath), body, { encoding: updateBlob.httpProps['Content-Encoding'] }) | ||
.then(() => { | ||
@@ -331,7 +331,7 @@ return response; | ||
// Make sure that the parent blob exists on storage. | ||
return fs.ensureFileAsync(blobPath) | ||
return fs.ensureFileAsync(this._escapeBlobDelimiter(blobPath)) | ||
.then(() => { | ||
// Writing block to disk. | ||
const blockPath = path.join(env.commitsPath, options.fileName); | ||
return fs.outputFileAsync(blockPath, body, { encoding: options.blob.httpProps['Content-Encoding'] }); | ||
return fs.outputFileAsync(this._escapeBlobDelimiter(blockPath), body, { encoding: options.blob.httpProps['Content-Encoding'] }); | ||
}) | ||
@@ -397,3 +397,3 @@ .then(() => { | ||
return new BbPromise((resolve, reject) => { | ||
const destinationStream = fs.createWriteStream(blobPath); | ||
const destinationStream = fs.createWriteStream(this._escapeBlobDelimiter(blobPath)); | ||
destinationStream | ||
@@ -647,3 +647,3 @@ .on('error', (e) => { | ||
blobPath = path.join(env.localStoragePath, containerName, blob.name), | ||
writeStream = fs.createWriteStream(blobPath, { | ||
writeStream = fs.createWriteStream(this._escapeBlobDelimiter(blobPath), { | ||
flags: 'r+', | ||
@@ -860,4 +860,21 @@ start: startByte, | ||
} | ||
/** | ||
* Not all allowed delimiters for blob names are valid file names. We thus replace those that are invalid with the valid | ||
* delimiter @ on disk. Note that in our in-memory database and thus for the external interface we still | ||
* use the originally chosen delimiter. | ||
*/ | ||
_escapeBlobDelimiter(blobPath) { | ||
if (process.platform === 'win32') { | ||
const pathWithoutLetter = blobPath.substr(2); | ||
if (pathWithoutLetter === '') { | ||
return blobPath; | ||
} | ||
return ( blobPath.substr(0, 2) + pathWithoutLetter.replace(/(::|:|\/|\||\/\/)/g, '@') ); | ||
} else { | ||
return blobName.replace(/(::|:|\||\$)/g, '@'); | ||
} | ||
} | ||
} | ||
module.exports = new StorageManager; |
{ | ||
"name": "azurite", | ||
"version": "0.7.7", | ||
"version": "0.7.8", | ||
"description": "A lightweight server clone of Azure Blob Storage that simulates most of the commands supported by it with minimal dependencies.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
3084
172741