vuepress icon indicating copy to clipboard operation
vuepress copied to clipboard

Cannot access static files nested in public folder

Open sotrh opened this issue 3 years ago • 2 comments

  • [x] I confirm that this is an issue rather than a question.

Bug report

I have the following file structure in my .vuepress/public folder:

  • public
    • res
      • tutorial9
        • cube-diffuse.jpg
        • cube.mtl
        • cube.obj

While I can access a file in the pubic folder directly, I get a 404 when I try to access files inside of folders inside the public folder.

Steps to reproduce

  1. Create a new vuepress project (or use and existing one)
  2. Create a public folder in the .vuepress folder
  3. Create a folder inside the public folder
  4. Add any file into the nested folder
  5. Start the vuepress server
  6. Attempt to access the nested file

What is expected?

The file will accessible as it would be if it were in the root of the public folder.

What is actually happening?

Vuepress will give a 404 for the file. My guess is that this is due to the router catching the request and then 404ing because the route doesn't exist in config.js.

Other relevant information

  • Output of npx vuepress info in my VuePress project: Environment Info:

    System: OS: Linux 5.15 Pop!_OS 20.04 LTS CPU: (16) x64 AMD Ryzen 7 5700U with Radeon Graphics Binaries: Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node Yarn: 1.22.15 - ~/.nvm/versions/node/v16.13.0/bin/yarn npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm Browsers: Chrome: Not Found Firefox: 95.0 npmPackages: @vuepress/core: 1.9.5 @vuepress/theme-default: 1.9.5 vuepress: ^1.9.5 => 1.9.5 npmGlobalPackages: vuepress: Not Found

sotrh avatar Jan 09 '22 03:01 sotrh

Hi @sotrh,

First of all, thanks for your interest in VuePress 1.X :heart:

Can you provide a repo reproducing the error please so that I can help you in solving your incident?

Have a nice day/evening,

Cheers.

GregoireF avatar Jan 23 '22 22:01 GregoireF

The code is at https://github.com/sotrh/learn-wgpu/tree/web2 You should then run yarn dev or npm run dev. You'll be able to access the files in the public folder (ie. localhost:8080/learn-wgpu/cube-diffuse.jpg`, but you'll get a 404 for any of the files in the nested res/tutorial9-models/res directory (ie. localhost:8080/learn-wgpu/res/tutorial9-models/res/cube-diffuse.jpg)

sotrh avatar Jan 26 '22 03:01 sotrh

Hello, I am facing the same issue, any update on this?

aaqibqadeer avatar Oct 04 '22 05:10 aaqibqadeer