davideuler / gitblit

Automatically exported from code.google.com/p/gitblit
Apache License 2.0
0 stars 0 forks source link

RawServlet issue when the project name is longer than the repository name #478

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Navigate to the "new repository" page
2. In the "name" field put areallylongprojectname/repo.git
3. Check the "Include a README" checkbox.
4. Click [Create]
5. Navigate to the "tree" tab on the newly created repositories page.
6. Click the "raw" link next to the README.md file.

What is the expected output? What do you see instead?
Expected output was to see the raw README.md file

Actual output:
HTTP ERROR 500

Problem accessing /raw/areallylongprojectname/repo.git/master/README.md. Reason:

    Server Error

Caused by:

java.lang.NullPointerException
    at com.gitblit.servlet.RawServlet.processRequest(RawServlet.java:387)
    at com.gitblit.servlet.RawServlet.doGet(RawServlet.java:481)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:738)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1651)
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:294)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1639)
    at com.gitblit.servlet.EnforceAuthenticationFilter.doFilter(EnforceAuthenticationFilter.java:87)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1639)
    at com.gitblit.servlet.AccessRestrictionFilter.doFilter(AccessRestrictionFilter.java:243)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1639)
    at com.gitblit.servlet.ProxyFilter$1.doFilter(ProxyFilter.java:74)
    at com.gitblit.servlet.ProxyFilter.doFilter(ProxyFilter.java:67)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1631)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:549)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:568)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:478)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:462)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:279)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:232)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:534)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536)
    at java.lang.Thread.run(Thread.java:745)

What version of the product are you using? On what operating system?
GitBlit Version 1.6.0

Please provide any additional information below.

There is a bug in the RawServlet when parsing the repository path out of the 
url. If the project name is longer than the repository name it will fail to 
find the repository path because it adds the index of the first / twice when 
trying to parse out the repository path. 

Fix to bug.

Just need to increment offset by 1 to exclude the character whose index was 
just returned. 

Please find attached patch that fixes this issue.

Original issue reported on code.google.com by robertmr...@gmail.com on 1 Aug 2014 at 2:15

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by James.Mo...@gmail.com on 12 Aug 2014 at 6:29

GoogleCodeExporter commented 9 years ago
Thanks for the patch!  Fix pushed to master.

Original comment by James.Mo...@gmail.com on 5 Sep 2014 at 4:14

GoogleCodeExporter commented 9 years ago
v1.6.1 released

Original comment by James.Mo...@gmail.com on 20 Oct 2014 at 9:36