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

Bump actions/checkout from 3 to 4 #2

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Guard against input and output being on different fs roots
  • Loading branch information
niloc132 committed Oct 12, 2022
commit 33feccc3388ea58851ea400639f9076b056af225
19 changes: 12 additions & 7 deletions src/com/google/javascript/jscomp/CommandLineRunner.java
Original file line number Diff line number Diff line change
@@ -75,6 +75,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.logging.Level;
@@ -2094,14 +2095,18 @@ private ClosureBundler getBundler() {
@Override
protected void prepForBundleAndAppendTo(Appendable out, CompilerInput input, String content, String outputPath)
throws IOException {
String pathToInput = new File(input.getName()).getCanonicalPath();
String pathToOutput = new File(outputPath).getParentFile().getCanonicalPath();
String relativePath = Paths.get(pathToOutput).relativize(Paths.get(pathToInput)).toString();

ClosureBundler bundler;
if (!relativePath.startsWith("..")) {
bundler = getBundler().useEval(true).withSourceUrl(relativePath);
Path pathToInput = Paths.get(new File(input.getName()).getCanonicalPath());
Path pathToOutput = Paths.get(new File(outputPath).getParentFile().getCanonicalPath());
final ClosureBundler bundler;
if (Objects.equals(pathToInput.getRoot(), pathToOutput.getRoot())) {
String relativePath = pathToOutput.relativize(pathToInput).toString();
if (!relativePath.startsWith("..")) {
bundler = getBundler().useEval(true).withSourceUrl(relativePath);
} else {
bundler = getBundler();
}
} else {
// Didn't share a root (such as two different windows drives), must not relativize
bundler = getBundler();
}