瀏覽代碼

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

Chouser 14 年之前
父節點
當前提交
eea6cbe45e
共有 1 個文件被更改,包括 4 次插入1 次删除
  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')