Skip to content
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

src/wuWxapkg.js Line 158 缺陷未考虑workDir不是文件夹的情况 #32

Open
stathamcheng opened this issue Feb 3, 2023 · 1 comment

Comments

@stathamcheng
Copy link

          let findDir = function (dir, oldDir) {
                let files = fs.readdirSync(dir);
                for (const file of files) {
                    let workDir = path.join(dir, file);   //此处workDir不是文件夹会导致fs.readdirSync(dir)抛异常,未考虑其处理逻辑
                    if (fs.existsSync(path.resolve(workDir, "app-service.js"))) {
                        console.log("sub package word dir: " + workDir);
                        mainDir = path.resolve(oldDir, mainDir);
                        console.log("real mainDir: " + mainDir);
                        dealThreeThings(workDir, mainDir, oldDir);
                        doSubPkg = true;
                        return true;
                    } else {
                        findDir(workDir, oldDir);
                    }
                }

            };
@stathamcheng
Copy link
Author

而且,如果遍历完成后仍未 满足 if (fs.existsSync(path.resolve(workDir, "app-service.js"))) 条件,将会抛178行ERROR:(throw new Error("检测到此包是分包后的子包, 请通过 -s 参数指定存放路径后重试, 如 node wuWxapkg.js -s=/xxx/xxx ./testpkg/test-pkg-sub.wxapkg");)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant