Scriptrunner - Restrict file size

Hello,

I just read the introduction of Adaptavist Scriptrunner and was asking whether the Pre-Receive hook for file size restrictions really checks the format of the file, i.e. binary or text. 

That would be really great if it blocks binary file of 5MB but not a textfile of 5MB.

Screen Shot 2017-11-07 at 22.11.19.png

1 answer

1 vote

You can do this using pathsMatch in the condition for the "Restrict file size" hook as explained here. Unfortunately you have to list out all the binary file extensions you wish to block.

If you want to block all binary files you can use the "custom pre-receive hook" also listed here.

Hope this helps.

Thanks for the reply. Decision by file extension is not really helpful because then I have to know by definition either the allowed binary file extensions or the allowed text file extensions. The custom pre-receive hook sounds interesting also because I'm interested in many examples as possible writing such scripts.

In my case I decided to do it in a local pre-commit hook by checking the 1st 4096 bytes of any staged file for deviations to the allowed ascii characters.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

173 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you