-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle dumi file path #12350
base: master
Are you sure you want to change the base?
fix: handle dumi file path #12350
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
漫步解读此次更新主要对 变更
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
@@ -17,7 +17,7 @@ export async function getApiRoutes(opts: { api: IApi }) { | |||
}); | |||
|
|||
function localPath(path: string) { | |||
if (path.charAt(0) !== '.') { | |||
if (path.charAt(0) !== '.' || path.charAt(1) !== '/') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请确保在访问 path.charAt(1)
之前,字符串长度至少为2。
- if (path.charAt(0) !== '.' || path.charAt(1) !== '/') {
+ if (path.length > 1 && (path.charAt(0) !== '.' || path.charAt(1) !== '/')) {
return `./${path}`;
}
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if (path.charAt(0) !== '.' || path.charAt(1) !== '/') { | |
if (path.length > 1 && (path.charAt(0) !== '.' || path.charAt(1) !== '/')) { |
@@ -79,7 +79,7 @@ export async function getRoutes(opts: { | |||
} | |||
|
|||
function localPath(path: string) { | |||
if (path.charAt(0) !== '.') { | |||
if (path.charAt(0) !== '.' || path.charAt(1) !== '/') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请确保在访问 path.charAt(1)
之前,字符串长度至少为2。
- if (path.charAt(0) !== '.' || path.charAt(1) !== '/') {
+ if (path.length > 1 && (path.charAt(0) !== '.' || path.charAt(1) !== '/')) {
return `./${path}`;
} else {
return path;
}
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
if (path.charAt(0) !== '.' || path.charAt(1) !== '/') { | |
if (path.length > 1 && (path.charAt(0) !== '.' || path.charAt(1) !== '/')) { | |
return `./${path}`; | |
} else { | |
return path; | |
} |
这个是用在哪个用例上啊,有详细上下文吗,什么情况会发生错误。 |
@fz6m Thank you for your confirmation. The following is the error log.
|
dumi 的项目是没有 umi 这个命令的,只有 我初始化了一个 dumi 项目,运行 如有问题,给一个最小复现吧。 |
Description
Fixed an error that occurred when running
pnpm umi plugin list
Motivation
.dumi
file path is not handled correctlySummary by CodeRabbit
'.'
或'/'
开头的路径字符串。