mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-08-25 11:33:53 +00:00
Reject paths in .tool-versions (#1007)
## Summary - reject path-like uv versions from `.tool-versions` - reject path-like Python versions from `.tool-versions` - document the restriction and cover Unix and Windows paths in tests ## Testing - `npm ci --ignore-scripts` - `npm run all` Refs: pi-session 019ff4bb-8b7c-7c4b-8bdf-7c188dfa2e3f
This commit is contained in:
+4
-1
@@ -61862,7 +61862,7 @@ function getPythonVersionFromToolVersions(filePath) {
|
||||
return void 0;
|
||||
}
|
||||
const version3 = stripVersionPrefix(versions[0]);
|
||||
if (version3 === "system" || version3.startsWith("ref:") || version3.startsWith("path:")) {
|
||||
if (version3 === "system" || version3.startsWith("ref:") || version3.startsWith("path:") || isPath(version3)) {
|
||||
warning(
|
||||
`The Python version ${versions[0]} in .tool-versions is not supported. The Python entry will be ignored.`
|
||||
);
|
||||
@@ -61890,6 +61890,9 @@ function getToolVersions(filePath, toolName) {
|
||||
function stripVersionPrefix(version3) {
|
||||
return version3.startsWith("v") ? version3.slice(1) : version3;
|
||||
}
|
||||
function isPath(version3) {
|
||||
return version3.includes("/") || version3.includes("\\");
|
||||
}
|
||||
|
||||
// src/utils/config-file.ts
|
||||
var import_node_fs3 = __toESM(require("node:fs"), 1);
|
||||
|
||||
+10
-1
@@ -99245,6 +99245,12 @@ function getUvVersionFromToolVersions(filePath) {
|
||||
return void 0;
|
||||
}
|
||||
const version3 = stripVersionPrefix(versions[0]);
|
||||
if (isPath(version3)) {
|
||||
warning(
|
||||
`The uv version ${versions[0]} in .tool-versions is not supported. Paths are not allowed.`
|
||||
);
|
||||
return void 0;
|
||||
}
|
||||
if (version3.startsWith("ref")) {
|
||||
warning(
|
||||
"The ref syntax of .tool-versions is not supported. Please use a released version instead."
|
||||
@@ -99265,7 +99271,7 @@ function getPythonVersionFromToolVersions(filePath) {
|
||||
return void 0;
|
||||
}
|
||||
const version3 = stripVersionPrefix(versions[0]);
|
||||
if (version3 === "system" || version3.startsWith("ref:") || version3.startsWith("path:")) {
|
||||
if (version3 === "system" || version3.startsWith("ref:") || version3.startsWith("path:") || isPath(version3)) {
|
||||
warning(
|
||||
`The Python version ${versions[0]} in .tool-versions is not supported. The Python entry will be ignored.`
|
||||
);
|
||||
@@ -99293,6 +99299,9 @@ function getToolVersions(filePath, toolName) {
|
||||
function stripVersionPrefix(version3) {
|
||||
return version3.startsWith("v") ? version3.slice(1) : version3;
|
||||
}
|
||||
function isPath(version3) {
|
||||
return version3.includes("/") || version3.includes("\\");
|
||||
}
|
||||
|
||||
// src/version/uv-lock-file.ts
|
||||
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
||||
|
||||
Reference in New Issue
Block a user