-
Notifications
You must be signed in to change notification settings - Fork 167
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: Fail-fast if the path to npm cache contains whitespaces #11517
Conversation
|
||
private ToolStubInfo(boolean stubbed, String version) { | ||
this.stubbed = stubbed; | ||
assert !stubbed || version != null && !version |
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.
OperatorPrecedence: Use grouping parenthesis to make the operator precedence explicit
(at-me in a reply with help
or ignore
)
File binDir = new File(baseDir, "node/node_modules/npm/bin"); | ||
FileUtils.forceMkdir(binDir); | ||
String stub = "process.argv.includes('--version') && console.log('6.14.10');"; | ||
String stub = String.format("process.argv.includes('--version') && " | ||
+ "console.log(%s);", stubNpm.getVersion()); | ||
FileUtils.writeStringToFile(new File(binDir, "npm-cli.js"), stub, | ||
StandardCharsets.UTF_8); | ||
FileUtils.writeStringToFile(new File(binDir, "npx-cli.js"), stub, | ||
StandardCharsets.UTF_8); | ||
} | ||
boolean isWindows = System.getProperty("os.name").startsWith("Windows"); |
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.
NULL_DEREFERENCE: object returned by getProperty("os.name")
could be null and is dereferenced at line 76.
(at-me in a reply with help
or ignore
)
flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendTools.java
Outdated
Show resolved
Hide resolved
flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskRunNpmInstall.java
Outdated
Show resolved
Hide resolved
flow-server/src/test/java/com/vaadin/flow/server/frontend/FrontendToolsTest.java
Outdated
Show resolved
Hide resolved
flow-server/src/test/java/com/vaadin/flow/server/frontend/TaskRunPnpmInstallTest.java
Outdated
Show resolved
Hide resolved
npmCacheCommand.add("--global"); | ||
String output = FrontendUtils.executeCommand(npmCacheCommand); | ||
output = parseCommandOutput(output); | ||
if (output.isEmpty()) { |
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.
NULL_DEREFERENCE: object output
last assigned on line 524 could be null and is dereferenced at line 525.
(at-me in a reply with help
or ignore
)
|
flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendTools.java
Outdated
Show resolved
Hide resolved
flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendTools.java
Outdated
Show resolved
Hide resolved
@@ -724,4 +799,11 @@ private String doGetNodeExecutable() { | |||
return getNodeExecutable(); | |||
} | |||
} | |||
|
|||
private String parseCommandOutput(String output) { |
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.
parse ?
What kind of parsing?
This is rather a conversation or just a "normalization"
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.
Yes, it's not a parsing, renamed to removeLineBreaks
.
flow-server/src/main/java/com/vaadin/flow/server/frontend/FrontendUtils.java
Outdated
Show resolved
Hide resolved
flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskRunNpmInstall.java
Show resolved
Hide resolved
flow-server/src/test/java/com/vaadin/flow/server/frontend/TaskRunPnpmInstallTest.java
Outdated
Show resolved
Hide resolved
SonarQube analysis reported 15 issues Top 10 issues
|
Hi @mshabarov and @denis-anisimov, when i performed cherry-pick to this commit to 2.7, i have encountered the following issue. Can you take a look and pick it manually? |
This ticket/PR has been released with platform 22.0.0.alpha2 and is also targeting the upcoming stable 22.0.0 version. |
Description
Checks that the npm version accepts whitespaces in user home path and explains how to fix that otherwise.
Fixes #10084
Type of change
Checklist
Additional for
Feature
type of change