summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2012-12-21 17:14:24 -0500
committerJames Moger <james.moger@gitblit.com>2012-12-21 17:14:24 -0500
commit7b0f3069ec3011650c9628b6e17c01d5e845ca46 (patch)
tree23e37f258bbcf368711f1035fc0e3ff4d74c9711
parent6f8ad9b1068e57062a5f79da83c10ee715d412ef (diff)
downloadgitblit-7b0f3069ec3011650c9628b6e17c01d5e845ca46.tar.gz
gitblit-7b0f3069ec3011650c9628b6e17c01d5e845ca46.zip
Added case-sensitive check for repository
-rw-r--r--src/com/gitblit/GitBlit.java13
-rw-r--r--src/com/gitblit/wicket/pages/RepositoryPage.java2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java
index 54ca6d20..076bb765 100644
--- a/src/com/gitblit/GitBlit.java
+++ b/src/com/gitblit/GitBlit.java
@@ -1652,7 +1652,18 @@ public class GitBlit implements ServletContextListener {
* @return true if the repository exists
*/
public boolean hasRepository(String repositoryName) {
- if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
+ return hasRepository(repositoryName, false);
+ }
+
+ /**
+ * Determines if this server has the requested repository.
+ *
+ * @param name
+ * @param caseInsensitive
+ * @return true if the repository exists
+ */
+ public boolean hasRepository(String repositoryName, boolean caseSensitiveCheck) {
+ if (!caseSensitiveCheck && settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
// if we are caching use the cache to determine availability
// otherwise we end up adding a phantom repository to the cache
return repositoryListCache.containsKey(repositoryName.toLowerCase());
diff --git a/src/com/gitblit/wicket/pages/RepositoryPage.java b/src/com/gitblit/wicket/pages/RepositoryPage.java
index 897e2001..aac527d7 100644
--- a/src/com/gitblit/wicket/pages/RepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/RepositoryPage.java
@@ -326,7 +326,7 @@ public abstract class RepositoryPage extends BasePage {
RepositoryModel model = GitBlit.self().getRepositoryModel(
GitBlitWebSession.get().getUser(), repositoryName);
if (model == null) {
- if (GitBlit.self().hasRepository(repositoryName)) {
+ if (GitBlit.self().hasRepository(repositoryName, true)) {
// has repository, but unauthorized
authenticationError(getString("gb.unauthorizedAccessForRepository") + " " + repositoryName);
} else {