fix: unexpected file request with custom publicDir, fix #4629#4631
Merged
patak-cat merged 1 commit intovitejs:mainfrom Aug 25, 2021
hyf0:fix/4629
Merged
fix: unexpected file request with custom publicDir, fix #4629#4631patak-cat merged 1 commit intovitejs:mainfrom hyf0:fix/4629
patak-cat merged 1 commit intovitejs:mainfrom
hyf0:fix/4629
Conversation
patak-cat
reviewed
Aug 16, 2021
patak-cat
approved these changes
Aug 17, 2021
Shinigami92
approved these changes
Aug 25, 2021
Member
Shinigami92
left a comment
There was a problem hiding this comment.
I mean... tests are green, yolo
meteorlxy
reviewed
Sep 14, 2021
Comment on lines
+128
to
+131
| const publicPath = | ||
| normalizePath(server.config.publicDir).slice( | ||
| server.config.root.length | ||
| ) + '/' |
Contributor
There was a problem hiding this comment.
const publicDir = '/foo/public'
const root = '/foo/bar/root'
publicDir.slice(root.length) + '/'
Contributor
Author
There was a problem hiding this comment.
@meteorlxy I guess if root.length is bigger than publicDir.length, we shouldn't throw a warning and just skip it.
Contributor
Author
There was a problem hiding this comment.
@meteorlxy Would you like to give a fix? Or I will fix it after home.
Contributor
There was a problem hiding this comment.
I think it should not be simply determined by the length. It's better to check if publicDir is inside root or not.
This was referenced Sep 14, 2021
aleclarson
pushed a commit
to aleclarson/vite
that referenced
this pull request
Nov 8, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix #4629.
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).