[Rocket] Dynamic multiple segment routes as a RawStr instead of PathBuf


#1

Is it possible in Rocket to treat multiple segment routes as a RawStr instead of a PathBuf? I don’t want any changes done to the dynamic part of the route (e.g. changing the segment separators). I want the dynamic part as is.

#[get("/page/<path..>")]
fn get_page(path: PathBuf /* Can this be a RawStr instead? */) -> T { ... }

I don’t care about path traversal attacks since this isn’t a path.


#2

What happens if you provide your own impl of FromSegments for your own type (possibly wrapping RawStr internally)?


#3

FromSegments takes an iterator of Segments. In other words by this point the string I want was already transformed and the “segment separators” removed.


#4

Oh I see. Not sure if we have a Rocket expert on this forum - I’m certainly not one :slight_smile:

You might get an answer faster if you ask this directly on Rocket’s github.