Support extra dir in uploaded module zip file.

When downloading a zip file from github, we have a directory more then
supported in the upload file action. This commit adds supports for an extra directory level.

Note: The code is rather nasty. I'll add some refactorings to it, to make it a more clean function.