Parcourir la source

Fix python server to handle old plugin requests without x-url

Chouser il y a 14 ans
Parent
commit
eea6cbe45e
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      pycl.py

+ 4 - 1
pycl.py

@@ -52,7 +52,10 @@ class Handler(BaseHTTPRequestHandler):
             # write text into file
             url = self.headers.getheader('x-url')
             print "url:", url
-            prefix = "chrome_" + re.sub("[^.\w]", "_", re.sub("^.*?//","",url))
+            prefix = "chrome_"
+            if url:
+                prefix += re.sub("[^.\w]", "_", re.sub("^.*?//","",url))
+            prefix += "_"
             if temp_has_delete==True:
                 f = tempfile.NamedTemporaryFile(
                         delete=False, prefix=prefix, suffix='.txt')