Fix: plugin loader cache not matching on decoupled plugin paths (#108529)
* fix(plugins): match decoupled plugin path in fe plugin loader cache * chore(devenv): update local_cdn to work with latest changes in core * refactor(plugins): improve legibility by splitting regexs into two * revert(devenv): revert -oss removal in local_cdn rewrite path
This commit is contained in:
@@ -19,6 +19,6 @@ server {
|
||||
add_header 'Access-Control-Allow-Headers' '*' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
|
||||
rewrite ^/grafana-oss/11.4.0-pre/public(.*)$ $1 last;
|
||||
rewrite ^/grafana-oss/12.1.0-pre/public(.*)$ $1 last;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,20 @@ export function getPluginFromCache(path: string): CachedPlugin | undefined {
|
||||
export function extractCacheKeyFromPath(path: string) {
|
||||
const regex = /\/?public\/plugins\/([^\/]+)\//;
|
||||
const match = path.match(regex);
|
||||
return match ? match[1] : null;
|
||||
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
|
||||
// Decoupled core plugins can be loaded by alternative paths
|
||||
const decoupledPluginRegex = /\/?public\/app\/plugins\/(?:datasource|panel)\/([^\/]+)\//;
|
||||
const decoupledPluginMatch = path.match(decoupledPluginRegex);
|
||||
|
||||
if (decoupledPluginMatch) {
|
||||
return decoupledPluginMatch[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getCacheKey(address: string): string | undefined {
|
||||
|
||||
Reference in New Issue
Block a user