Skip to content
Myr

Fixed template caching collision issue. Closes #644

Before adoption: this commit came in with the history the project adopted, so no landing records it.

the parent view is resolved first so we always have the absolute path available, so this should prevent collisions.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 351f6ab · Browse files · 1 file+6 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−3 removed

  • other:+6 added−3 removed

1 file+6 added−3 removed

modified:lib/view.js+6 added-3 removed
257 unmodified lines
258 , viewOptions = app.set('view options')259 , cacheViews = app.enabled('view cache')260 , root = app.set('views') || process.cwd() + '/views';261262 // cache id263 var cid = view + (parent ? ':' + parent.path : '');264265 // merge "view options"266 if (viewOptions) merge(options, viewOptions);267268 // merge res._locals
56 unmodified lines
325 return renderPartial(self, path, opts, options, view);326 };327328 // cached view326 if (app.cache[view]) {327 view = app.cache[view];329 if (app.cache[cid]) {330 view = app.cache[cid];331 options.filename = view.path;332 // resolve view333 } else {334 var orig = view = new View(view, options);
27 unmodified lines
362363 options.filename = view.path;364 var engine = view.templateEngine;365 view.fn = engine.compile(view.contents, options)363 if (cacheViews) app.cache[orig.view] = view;366 if (cacheViews) app.cache[cid] = view;367 }368369 // layout helper370 options.layout = function(path){
42 unmodified lines