pivotal-cf / azure-blobstore-resource

A concourse resource to interact with the azure blob service.
MIT License
16 stars 15 forks source link

Can't extract object when object key has a "folder #40

Closed kungfoome closed 3 years ago

kungfoome commented 3 years ago

Issue: When you have a blobname with a folder path in it and when you go to extract it, it can't find the file. The file gets downloaded to the tmp folder.

Example: object = somefolder/apps/artifact.tar.gz

File gets download to /tmp/build/23rfwef/artifact.tar.gz, but when it goes to extract the file, it is looking for the file at /tmp/build/23rfwef/somefolder/apps/artifact.tar.gz which doesn't exist.

What should happen: File gets downloaded to /tmp/build/23rfwef/artifact.tar.gz and it extracts from the same place it's downloaded to.

Solution: https://github.com/pivotal-cf/azure-blobstore-resource/blob/e7f086ccad6ffe1d7d586bfa595c738bd07968af/cmd/in/main.go#L77

blobName should be path.Base(blobName).

err = in.UnpackBlob(filepath.Join(destinationDirectory, path.Base(blobName)))