mirror of
https://github.com/purocean/yn.git
synced 2026-09-24 15:46:02 +08:00
fix: ensure paths start with a leading slash in withRepo function
This commit is contained in:
@@ -82,6 +82,11 @@ function withRepo<T> (repo = 'main', callback: (repoPath: string, ...targetPath:
|
||||
}
|
||||
|
||||
return callback(repoPath, ...target.map(x => {
|
||||
// fix path
|
||||
if (!x.startsWith('/')) {
|
||||
x = '/' + x
|
||||
}
|
||||
|
||||
const targetPath = isRootRepo
|
||||
? x.replace(/^\//, repoPath) // replace first / to repoPath for case of `\\127.0.0.1/test/a.md`
|
||||
: path.join(repoPath, x)
|
||||
|
||||
Reference in New Issue
Block a user