Code Monkey home page Code Monkey logo

Comments (9)

bradrydzewski avatar bradrydzewski commented on July 19, 2024

ahh, ok, looks like we should add a field called "branch_slug" that removes any characters that aren't URL friendly. We already have a helper function for this:
https://github.com/drone/drone/blob/master/pkg/model/util.go#L34

Off the top of my head, we'll need to:

  1. add BranchSlug to the Commit struct
  2. add the database column and index it
  3. alter any sql queries that use branch to use branch_slug
  4. alter any templates that use branch when constructing the URL and switch to branch_slug
  5. alter the badge template and badge code to use branch_slug

from gitness.

knoopx avatar knoopx commented on July 19, 2024

ahh, ok, looks like we should add a field called "branch_slug" that removes any characters that aren't URL friendly.

I would use the branch HEAD SHA1 rather than generate a "not-so friendly" slug

from gitness.

bradrydzewski avatar bradrydzewski commented on July 19, 2024

We let you filter your build history in the UI based on branch. The URL pattern follows a similar convention to GitHub: /github.com/:owner/:name/tree/:branch

Drone: https://localhost:8080/github.com/drone/drone/tree/master
GitHub: https://github.com/drone/drone/tree/master

I haven't looked, but I'm guessing GitHub strips non-friendly URL characters out of its branches as well?

from gitness.

knoopx avatar knoopx commented on July 19, 2024

I haven't looked, but I'm guessing GitHub strips non-friendly URL characters out of its branches as well?

from gitness.

bradrydzewski avatar bradrydzewski commented on July 19, 2024

ok, thanks for that info!

for now, we can just escape the branch value in our template:

{{ .Branch | html }}

this should get things working without having to commit to a specific approach just yet. I'm working on a patch now.

from gitness.

knoopx avatar knoopx commented on July 19, 2024

Great! also according to pat documentation:

replacing:

    m.Get("/:host/:owner/:name/tree/:branch", handler.RepoHandler(handler.RepoDashboard))

with:

    m.Get("/:host/:owner/:name/tree/:branch/", handler.RepoHandler(handler.RepoDashboard))

should make it work too

from gitness.

bradrydzewski avatar bradrydzewski commented on July 19, 2024

I wasn't able to get the pat route to work with the trailing slash :(

So for now we're using url query parameters. I'm not in the love with the approach, but at least it makes the system usable. feel free to pull the latest .deb to upgrade

from gitness.

donny-dont avatar donny-dont commented on July 19, 2024

Hey @bradrydzewski I think this is an issue in the 0.3 branch. If we uses /'s the UI doesn't work properly but if we use _ instead it appears.

from gitness.

bradrydzewski avatar bradrydzewski commented on July 19, 2024

Yes, I changed how we handle branches from 0.2 to 0.3 we'll need to update our server-side routes to use regular expressions to accomodate slashes /v1/api/repos/{host}/{owner}/{name}/branches/{branch:(.+)}

from gitness.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.