Skip to content

Commit

Permalink
fix: less plugin doesn't decoded path (#1360)
Browse files Browse the repository at this point in the history
* test: ✅ add space in path test case

* chore: 🔧 in case file has space

* fix: 🐛 less loader should unescape space
  • Loading branch information
stormslowly authored Jul 3, 2024
1 parent 15e722c commit 0462371
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ npm run biome:format
npx taplo format

# only add staged files though cargo fmt all projects
git add $(git diff --name-only --cached --diff-filter=AM)
git diff --name-only --cached --diff-filter=AM -z | xargs -0 git add
1 change: 1 addition & 0 deletions e2e/fixtures/less.normal/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import styles from "./index.less";
import "./space space/global.less";

export default () => {
return <div className={styles.container}>less.normal</div>;
Expand Down
3 changes: 3 additions & 0 deletions e2e/fixtures/less.normal/src/space space/global.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
color: black
}
2 changes: 1 addition & 1 deletion packages/mako/src/lessLoader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function lessLoader(fn: Function | null, opts: LessLoaderOpts) {
render: async (filePath: string) => {
let filename = '';
try {
filename = url.parse(filePath).pathname || '';
filename = decodeURIComponent(url.parse(filePath).pathname || '');
} catch (e) {
return;
}
Expand Down

0 comments on commit 0462371

Please sign in to comment.