fix static file serving when url has parameters (like cache busters do)
authorFlorent Cayré <florent.cayre@logilab.fr>
Wed, 18 Apr 2012 12:01:31 +0200
changeset 8389 94f26e3b09bf
parent 8388 c6c624cea870
child 8390 637b934bc742
fix static file serving when url has parameters (like cache busters do)
web/views/staticcontrollers.py
--- a/web/views/staticcontrollers.py	Wed May 09 15:06:43 2012 +0200
+++ b/web/views/staticcontrollers.py	Wed Apr 18 12:01:31 2012 +0200
@@ -183,13 +183,14 @@
         if relpath.startswith(self.data_modconcat_basepath):
             paths = relpath[len(self.data_modconcat_basepath):].split(',')
             filepath = self.concat_files_registry.concat_cached_filepath(paths)
-            return self.static_file(filepath)
         else:
-            relpath = relpath[len(self.base_datapath):] # skip leading '/data/'
-        dirpath, rid = config.locate_resource(relpath)
-        if dirpath is None:
-            raise NotFound()
-        return self.static_file(osp.join(dirpath, rid))
+            # skip leading '/data/' and url params
+            relpath = relpath[len(self.base_datapath):].split('?', 1)[0]
+            dirpath, rid = config.locate_resource(relpath)
+            if dirpath is None:
+                raise NotFound()
+            filepath = osp.join(dirpath, rid)
+        return self.static_file(filepath)
 
 
 class FCKEditorController(StaticFileController):