Fix JS plugin load when using non-root Gerrit URLs
When Gerrit is not on the root URL path the JS plugins failed to load because of the exact matching required on the request URL. Current check is now more flexible by checking only the suffix of the JS plugin path. NOTE: In theory this may recognise even different URLs than the intended one (e.g. /gerrit/bla/bla/bla/plugins/...) but however they would not land on the HttpPluginServlet anyway. That's why "endsWith" is good enough for this check. Change-Id: I299b244a9fcdc9b00175e2054a7ba7363620979b
This commit is contained in:
parent
85f97710d3
commit
90bef32620
@ -584,7 +584,8 @@ class HttpPluginServlet extends HttpServlet
|
||||
private void sendJsPlugin(Plugin plugin, ResourceKey key,
|
||||
HttpServletRequest req, HttpServletResponse res) throws IOException {
|
||||
File pluginFile = plugin.getSrcFile();
|
||||
if (req.getRequestURI().equals(getJsPluginPath(plugin)) && pluginFile.exists()) {
|
||||
if (req.getRequestURI().endsWith(getJsPluginPath(plugin))
|
||||
&& pluginFile.exists()) {
|
||||
res.setHeader("Content-Length", Long.toString(pluginFile.length()));
|
||||
res.setContentType("application/javascript");
|
||||
writeToResponse(res, new FileInputStream(pluginFile));
|
||||
|
Loading…
Reference in New Issue
Block a user