dalgibbard / citrix_xenserver_patcher

Auto / Manual Patching tool for Citrix XenServer Boxes
Do What The F*ck You Want To Public License
142 stars 45 forks source link

file_name appending '&noauth=true' to variable #62

Closed j2clerck closed 7 years ago

j2clerck commented 7 years ago

Hi,

I'm new to XenServer and this little utility is a beauty. On XenServer 7 there is a bug though at file_name var construction as the url contains "&noauth=true" at the end.

On line 325: file_name = url.split('/')[-1] I've added file_name = file_name('&')[0] just thereafter but I think a more proper test should be coded. ex: if file_name.find('&') file_name = file_name('&')[0]

Thanks again. Joseph.

dalgibbard commented 7 years ago

Nice spot! I don't have any Xenserver boxes to hand at the moment, so welcome any patches in the meantime :D

Mattz0r commented 7 years ago

I think this is a bug in general, it also happens on Xen Server 6.5

krajster commented 7 years ago

Hi, may be using this code: file_name = re.match(r'^.*?.zip', file_name).group(0)

freehussain commented 7 years ago

hello,

i found a solution for this issue,

just add the following after (line 325) file_name = url.split('/')[-1]

the following file_name = file_name.split('&')[0]

kind regards

Mattz0r commented 7 years ago

Nice one @freehussain, works here :)

dalgibbard commented 7 years ago

I've thrown that into master branch without testing - can you confirm it's OK? Then i'll close :)

index c7c4620..2104406 100755
--- a/patcher.py
+++ b/patcher.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 #
 # Citrix XenServer Patcher
-version = "1.5.2"
+version = "1.5.3"
 # -- Designed to automatically review available patches from Citrix's XML API,
 #    compare with already installed patches, and apply as necessary- prompting the user
 #    to reboot/restart the XE ToolStack if necessary.
@@ -322,7 +322,7 @@ def login():

 def download_patch(patch_url):
     url = patch_url
-    file_name = url.split('/')[-1]
+    file_name = url.split('/')[-1].split('&')[0]
     print("")
     print("Downloading: " + str(file_name))
     try:
Daniel-Furcht commented 7 years ago

Works!! Thanks.