Browse Source

Better removal of URL query params imo tbh lmao

Wazakindjes 3 years ago
parent
commit
c3d7ea8441
1 changed files with 3 additions and 4 deletions
  1. 3 4
      hurr.py

+ 3 - 4
hurr.py

@@ -378,11 +378,10 @@ if __name__ == "__main__":
 			print "Seems to be a URL too, checkin em sanity lol"
 			try:
 				checkem = urllib2.urlopen(temppath)
-				muhext = os.path.splitext(temppath)[1].strip().lower()
+				muhext = re.sub(r'([?&].*)+', '', temppath)
+				muhext = os.path.splitext(muhext)[1].strip().lower()
 				if not muhext:
-					raise Exception("unable to parse extension")
-				if "?" in muhext:
-					muhext = muhext.split('?')[0]
+					raise Exception("unable to parse extension lol")
 				muhext = muhext.split(':')[0]
 				temppath = "/tmp/%d%s" % (int(time.time()), muhext)
 				with open(temppath, "wb") as tmpf: