From bddac4b602e1c8884c740004fa77f511a3a169e9 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 6 May 2019 14:40:14 +0000 Subject: [PATCH] [FIX] base: allow assets names to start by another assets name Before this commit, if an assets was named 'assets_hello_world' and another one was named 'assets_hello' and that the first one was included in the DOM before the second one, trying to load the first one would result in a 404. Indeed, this is what would have happened: 1) Render the `t-call-assets="assets_hello_world"` directive -> compute the assets bundle then return a script with an url reaching that bundle. Do this after having deleted the previous bundle computation if any. 2) Render the `t-call-assets="assets_hello"` directive -> compute the assets bundle then return a script with an url reaching that bundle. Do this after having deleted the previous bundle computation if any. The problem is about "deleting the previous bundle computation" which was done... by deleting all attachments starting by the bundle name. This commit solves that by deleting the exact matches. Part of https://github.com/odoo/odoo/pull/32181 task-1961045 --- odoo/addons/base/models/assetsbundle.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/odoo/addons/base/models/assetsbundle.py b/odoo/addons/base/models/assetsbundle.py index 4b0cae5d189..7588cef3f1b 100644 --- a/odoo/addons/base/models/assetsbundle.py +++ b/odoo/addons/base/models/assetsbundle.py @@ -227,7 +227,8 @@ class AssetsBundle(object): url = self.get_asset_url( extra='%s' % ('rtl/' if type == 'css' and self.user_direction == 'rtl' else ''), name=self.name, - type=type + sep='', + type='.%s' % type ) domain = [ ('url', '=like', url),