Code Monkey home page Code Monkey logo

Comments (9)

pyrossh avatar pyrossh commented on June 23, 2024

@qxqxq have you taken a look at the example, You should be able to handle it with the single route handler. It seems to me that you could be missing the /static prefix in the path when calling handle_embedded_file.

from rust-embed.

qxqxq avatar qxqxq commented on June 23, 2024

@qxqxq have you taken a look at the example, You should be able to handle it with the single route handler. It seems to me that you could be missing the /static prefix in the path when calling handle_embedded_file.

How to handle it using a single routing handler, I don't know. In my opinion, the current code is just not very elegant. I don't think it's the absence of the /static prefix in the path. You can see my log in handle_Embedded_FILE. You can't explain why only a few files failed.

"GET /img/menu_logo.76408655.png HTTP/1.1" 404
[2022-05-12T10:29:03Z INFO xdls::controller::statics] img-params===Path("menu_logo.76408655.png")
[2022-05-12T10:29:03Z INFO xdls::controller::statics] handle_embedded_file path====img/menu_logo.76408655.png

"GET /img/logs.fa1e7ddd.css HTTP/1.1" 200
[2022-05-12T10:25:39Z INFO xdls::controller::statics] img-params===Path("logs.fa1e7ddd.css")
[2022-05-12T10:25:39Z INFO xdls::controller::statics] handle_embedded_file path====img/logs.fa1e7ddd.css

Take a look at the file in the static directory. Why one can succeed and the other can't.

from rust-embed.

qxqxq avatar qxqxq commented on June 23, 2024

@pyrossh There are 4 directories and 38 files in the static folder. There are 8 files in the IMG folder. Why only 7 files in img folder and 2 files in fonts folder will fail while the other 29 files are successful?

from rust-embed.

qxqxq avatar qxqxq commented on June 23, 2024

@pyrossh The example route prefix is dist, while my route prefix is JS and CSS and IMG and fonts.So I don't know how to handle it with the single route handle.

from rust-embed.

pyrossh avatar pyrossh commented on June 23, 2024

In this case you would use /static instead of /dist and also you would need to prefix the html/webpack to use /static/js instead of just js a simpler approach. Maybe that would be easier to figure out this bug.
But anyways those files and images which are missing could have an issue in the path/name I'm guessing. A simple example repo to reproduce this will help debugging it.

from rust-embed.

qxqxq avatar qxqxq commented on June 23, 2024

@pyrossh All files were successful in Cargo Build. An error occurs only when cargo Build --release is used.

from rust-embed.

qxqxq avatar qxqxq commented on June 23, 2024

In this case you would use /static instead of /dist and also you would need to prefix the html/webpack to use /static/js instead of just js a simpler approach. Maybe that would be easier to figure out this bug. But anyways those files and images which are missing could have an issue in the path/name I'm guessing. A simple example repo to reproduce this will help debugging it.

I tried to work with HTML/Webpack in the same way as the example.

from rust-embed.

pyrossh avatar pyrossh commented on June 23, 2024

Ahh ok it seems to fail in release only. Also it seems .css file in img directory works. Can you try with another css file in that directory as well as in the fonts directory and see if that works.
Seems to me maybe in release maybe it's failing to load other content types because css is a text format whereas images are binary format.

Also do disable your cache while testing maybe that would help in finding out.

from rust-embed.

pyrossh avatar pyrossh commented on June 23, 2024

Closing this due to inactivity.

from rust-embed.

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.