-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build failure when image file name includes special characters (#…
…9781) The latest version of `vite-plugin-markdown` uses a regular expression that includes the file path via string concatenation. However the file path is not escaped for use in a regular expressions. So if a markdown document includes a reference to an image file name which includes certain special characters it will cause the build to fail. This patch escapes regex special characters in the file path string being injected into the regular expression. While I found that not all special characters will cause this problem, it seems safer to simply escape all regex specials. I also added test to verify this. Related to: Commit 165cfc1 Co-authored-by: Erika <[email protected]>
- Loading branch information
1 parent
5e466ef
commit ccc05d5
Showing
5 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"astro": patch | ||
--- | ||
|
||
Fix build failure when image file name includes special characters |
This file contains 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
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
packages/astro/test/fixtures/core-image/src/pages/specialChars.md
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
![C++](../assets/c++.png) | ||
|
||
Image with special characters in file name worked. |