Code Monkey home page Code Monkey logo

Comments (2)

gterras avatar gterras commented on June 9, 2024

This kind of sounds like a stick to beat you with considering your param is rest and can contain both slashes and the next segment separator. I see multiple solutions without expanding the params API (which has little to none room left):

  • make repo a non-rest parameter
  • have another separator segment like /@/ instead of /-/
  • encode your repo parameter

The rest parameters docs has an example demonstrating exactly what you are trying to do, is there anything different in your case?

from kit.

fkling avatar fkling commented on June 9, 2024

The rest parameters docs has an example demonstrating exactly what you are trying to do, is there anything different in your case?

The repository identifiers are relatively free form. The might match [codehost]/[org]/[repo] but they could also just be [repo] or any other pattern, e.g. on self-hosted instances.

  • make repo a non-rest parameter
  • encode your repo parameter

It seems like these would have to go together since repo cannot contain / without being encoded. This is not practical in our case because it wouldn't work for existing links. And, to a lesser degree, it doesn't look good either.

have another separator segment like /@/ instead of /-/

That would result in the same problem if file path contains /@/ anywhere. Also it would break existing links so changing the overall structure of these URLs is not really possible.

This kind of sounds like a stick to beat you with considering your param is rest and can contain both slashes and the next segment separator.

repo cannot contain /-/. That's one of the few restrictions and is encoded in the parameter matcher. That's why I was surprised that adding the matcher doesn't solve the problem. I expected the routing logic to match the whole path differently.


It's an existing application that I'm build a prototype in SvelteKit for.
I acknowledge that the situation is not ideal, but the server as well as the existing client is able to parse these URLs as desired. So it doesn't seem too unreasonable to allow more control over the parsing process, even if it's something that needs to be done carefully.

from kit.

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.