You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2021/12/13 00:48:03 UTC
[lucene-solr] branch branch_8_11 updated: SOLR-15804 Support leading slash for "file" parameter, to mean relative to config dir. Support text/javascript (#2629)
This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch branch_8_11
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8_11 by this push:
new 866e620 SOLR-15804 Support leading slash for "file" parameter, to mean relative to config dir. Support text/javascript (#2629)
866e620 is described below
commit 866e62083e672b7af09a2ed16f33827029e02534
Author: Jan Høydahl <ja...@users.noreply.github.com>
AuthorDate: Mon Dec 13 01:47:47 2021 +0100
SOLR-15804 Support leading slash for "file" parameter, to mean relative to config dir. Support text/javascript (#2629)
---
.../java/org/apache/solr/handler/admin/ShowFileRequestHandler.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
index 3654b93..f27f31c 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
@@ -105,6 +105,7 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis
static {
KNOWN_MIME_TYPES = new HashSet<>(MimeTypes.getKnownMimeTypes());
KNOWN_MIME_TYPES.add("text/xml");
+ KNOWN_MIME_TYPES.add("text/javascript");
}
public ShowFileRequestHandler()
@@ -374,7 +375,8 @@ public class ShowFileRequestHandler extends RequestHandlerBase implements Permis
rsp.setException(new SolrException( SolrException.ErrorCode.FORBIDDEN, "Can not access: "+fname ));
return null;
}
- Path filePath = configdir.toPath().resolve(fname);
+ // A leading slash is unnecessary but supported and interpreted as start of config dir
+ Path filePath = configdir.toPath().resolve(fname.startsWith("/") ? fname.substring(1) : fname);
req.getCore().getCoreContainer().assertPathAllowed(filePath);
adminFile = filePath.toFile();
}