[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
This commit is contained in:
qsm-odoo
2019-06-04 07:57:20 +00:00
parent ed924e956d
commit bddac4b602
+2 -1
View File
@@ -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),