@@ -174,7 +174,10 @@ component accessors=true singleton ThreadSafe {
174174 * @overwrite Whether to overwrite the blob if it already exists
175175 * @timeoutSeconds The timeout for the upload operation
176176 */
177- function uploadBlobFromFile ( required string containerName = settings .containerName , required string blobName , required string filePath , boolean overwrite = settings .overwrite , numeric timeoutSeconds = 60 ) {
177+ function uploadBlobFromFile ( required string containerName = settings .containerName , required string blobName , required string filePath , boolean overwrite = settings .overwrite , numeric timeoutSeconds = 60 , boolean expandPaths = settings .expandPaths ) {
178+ if ( expandPaths ) {
179+ filePath = expandPath ( filePath );
180+ }
178181 if ( ! overwrite && blobExists ( containerName , blobName , timeoutSeconds ) ) {
179182 throw (
180183 type = " BlobStorage.BlobAlreadyExists" ,
@@ -184,7 +187,7 @@ component accessors=true singleton ThreadSafe {
184187
185188 var timeoutDuration = getDuration ( timeoutSeconds );
186189 var blobClient = getContainerClient ( containerName ).getBlobClient ( blobName );
187- var uploadOptions = createObject ( ' java' , ' com.azure.storage.blob.options.BlobUploadFromFileOptions' ).init ( expandPath ( filePath ) );
190+ var uploadOptions = createObject ( ' java' , ' com.azure.storage.blob.options.BlobUploadFromFileOptions' ).init ( filePath );
188191 blobClient .uploadFromFileWithResponse ( uploadOptions , timeoutDuration , noneContext );
189192 return this ;
190193 }
@@ -222,8 +225,11 @@ component accessors=true singleton ThreadSafe {
222225 *
223226 * @return The response object containing metadata about the download operation.
224227 */
225- function downloadBlobToFile ( required string containerName = settings .containerName , required string blobName , required string filePath , numeric timeoutSeconds = 60 , numeric maxDownloadRetries = settings .maxDownloadRetries , boolean overwrite = settings .overwrite ) {
226- if ( ! overwrite && fileExists ( expandPath ( filePath ) ) ) {
228+ function downloadBlobToFile ( required string containerName = settings .containerName , required string blobName , required string filePath , numeric timeoutSeconds = 60 , numeric maxDownloadRetries = settings .maxDownloadRetries , boolean overwrite = settings .overwrite , boolean expandPaths = settings .expandPaths ) {
229+ if ( expandPaths ) {
230+ filePath = expandPath ( filePath );
231+ }
232+ if ( ! overwrite && fileExists ( filePath ) ) {
227233 throw (
228234 type = " BlobStorage.FileAlreadyExists" ,
229235 message = " File '#filePath #' already exists. Use overwrite=true to replace it."
@@ -234,7 +240,7 @@ component accessors=true singleton ThreadSafe {
234240
235241 var downloadOptions = // TODO: setOpenOptions(Set<OpenOption> openOptions), setParallelTransferOptions(ParallelTransferOptions parallelTransferOptions), setRange(BlobRange range), setRequestConditions(BlobRequestConditions requestConditions), setRetrieveContentRangeMd5(boolean retrieveContentRangeMd5)
236242 createObject ( ' java' , ' com.azure.storage.blob.options.BlobDownloadToFileOptions' )
237- .init ( expandPath ( filePath ) )
243+ .init ( filePath )
238244 .setDownloadRetryOptions ( getDownloadRetryOptions ( maxDownloadRetries ) );
239245
240246 if ( arguments .overwrite ) {
0 commit comments