From: Thierry Parmentelat Date: Thu, 5 Feb 2009 17:15:04 +0000 (+0000) Subject: protect against spaces in filenames X-Git-Tag: PLCAPI-4.3-4~21 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a040c4569c5d3aa73aa4166472ef256c8437be46;p=plcapi.git protect against spaces in filenames --- diff --git a/PLC/Methods/GetBootMedium.py b/PLC/Methods/GetBootMedium.py index 3e260ed..e2d1ebf 100644 --- a/PLC/Methods/GetBootMedium.py +++ b/PLC/Methods/GetBootMedium.py @@ -464,11 +464,11 @@ class GetBootMedium(Method): generic_path = "%s/%s" % (self.GENERICDIR,generic_name) if filename: - ret=os.system ("cp %s %s"%(generic_path,filename)) + ret=os.system ('cp "%s" "%s"'%(generic_path,filename)) if ret==0: return filename else: - raise PLCPermissionDenied, "Could not copy %s into"%(generic_path,filename) + raise PLCPermissionDenied, "Could not copy %s into %s"%(generic_path,filename) else: ### return the generic medium content as-is, just base64 encoded return base64.b64encode(file(generic_path).read()) @@ -542,7 +542,7 @@ class GetBootMedium(Method): # handle result if filename: - ret=os.system("mv %s %s"%(node_image,filename)) + ret=os.system('mv "%s" "%s"'%(node_image,filename)) if ret != 0: self.trash.append(node_image) self.cleantrash()