Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not aceess custom file #850

Closed
incker opened this issue May 14, 2021 · 1 comment
Closed

Can not aceess custom file #850

incker opened this issue May 14, 2021 · 1 comment

Comments

@incker
Copy link

incker commented May 14, 2021

I want to select file path + tail + ".gz"

My shorten code:

let route  = warp::any()
    .map(move || path.clone())
    .and(warp::path::tail())
    .and_then(|path, tail| warp::fs::file("index.html").filter());

I receive an error:

65 |         .and_then(|path, tail| warp::fs::file("index.html").filter());
   |                                                             ^^^^^^ method cannot be called on `impl warp::filter::FilterClone` due to unsatisfied trait bounds

And this code:

let route3 = warp::any()
    .map(move || path.clone())
    .and(warp::path::tail())
    .and_then(|path, tail| async { warp::fs::file("index.html") });

Gives such error:

65 |         .and_then(|path, tail| async {warp::fs::file("index.html")});
   |          ^^^^^^^^ expected opaque type, found enum `Result`

How can I call warp::fs::file(path). with custom path, based on tail but ends on tail + ".gz"?
Thank you

@incker incker added the bug Something isn't working label May 14, 2021
@jxs
Copy link
Collaborator

jxs commented May 17, 2021

Hi, yeah at the moment it's a shortcoming of the file filter, it has been raised on #526 as well, see also #171 (comment) for more info.
Thanks

@jxs jxs closed this as completed May 17, 2021
@jxs jxs removed the bug Something isn't working label May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants