Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Have .zip download file name be static (master.zip) without commit ID

Garrett Massey September 29, 2021

Currently, when downloading a bitbucket repository as a .zip, the file name is usually something like teamname-reponame-f74592.zip where the last bit is the most recent commit to the branch being downloaded.

Our usage requires that the name of the file be the same each time it is downloaded, as it automatically overrides the directory (in the WordPress Plugins folder). Is there a way to set the downloads to have a static name instead of the current name of the commit?

1 answer

0 votes
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 30, 2021

Hi, @Garrett Massey! Welcome to the community! 

Indeed, if you download the file, it will give you the commit number. However, you can choose the branch you would like to download and use the following command to specify the file name of your download:

BRANCH='{master}'; WORKSPACE='{workspace_name}'; REPO='{repo_name}'; FOLDER='{new_folder}'; curl -u <username>:<password> https://bitbucket.org/$WORKSPACE/$REPO/get/$BRANCH.zip -s -o $REPO.zip && unzip -q $REPO.zip && find ./$WORKSPACE-$REPO-/ -exec mv {} $FOLDER/${f##/} ;

All you need to do is replace the master, workspace_name, repo_name, and new_folder with whatever you need. 

This way, the zip file will be downloaded and it will have the repository name, and another folder will be created in your current working directory with the name you informed in “new_folder". This folder will contain all the content that is inside this zip file (in other words, it will unzip the file). 

I hope this helps, but do let me know if you have any questions. Also, if you would like to open a feature request for that, I can definitely do this for you, just let me know :)

Kind regards,
Caroline

Garrett Massey October 1, 2021

Thank you for your answer! Unfortunately, this solution isn't quite what we need for our process. We are using WordPress for our websites, and we can't currently specify the curl command like that for getting the zip for updates. 

Our current workflow is that we check the master branch for any changes to a specific file, and then if that file has changed it prompts wordpress to notify for an update. Then the user clicks "Update plugin" and Wordpress fetches the zip from the URL as-is, so we can't use the `-o` option to specify the output file.

If you could open a feature request that would be fantastic. Something that would allow us to set the output in the BitBucket GUI for all downloads would be fantastic.

Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 1, 2021

Hi, Garrett. 

Thanks for getting back to us! In this case, I created the following feature request to implement this change:

I would suggest that you add your vote there (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features. 

You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy here and any updates will be posted in the feature request. 

Please, feel free to share any additional questions regarding this subject.

Kind regards,
Caroline

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events