@evandu/super-pi 0.1.284 → 0.1.285

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  <link rel="alternate icon" href="/favicon.ico" />
9
9
  <link rel="apple-touch-icon" href="/favicon.svg" />
10
10
  <title>Super Pi</title>
11
- <script type="module" crossorigin src="/assets/index-IafH0r-m.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-l_Knh78R.js"></script>
12
12
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
13
13
  <link rel="stylesheet" crossorigin href="/assets/index-CMb8f0dS.css">
14
14
  </head>
@@ -23,13 +23,10 @@ async function selectedFile(workspace, root, input) {
23
23
  const name = posix.basename(relative);
24
24
  if (!name || name === "." || name === "..")
25
25
  throw new FilesError(400, "请选择一个文件。", "not_a_file");
26
- const parent = await explorerPath(workspace, root, posix.dirname(relative), true);
27
- const file = resolve(parent, name);
28
- if (explorerInternalPath(toRelative(workspace, file))) {
26
+ const file = resolve(root, relative);
27
+ if (contains(resolve(workspace), file) && explorerInternalPath(toRelative(workspace, file))) {
29
28
  throw new FilesError(403, "不能直接访问应用的回收目录。", "protected_path");
30
29
  }
31
- if (!(await lstat(file)).isSymbolicLink())
32
- await explorerPath(workspace, root, relative);
33
30
  return file;
34
31
  }
35
32
  async function readOpenedFile(path) {
@@ -78,7 +75,8 @@ export function createExplicitFileOpen() {
78
75
  if (contains(canonicalRoot, path)) {
79
76
  const scoped = toRelative(canonicalRoot, path);
80
77
  await explorerPath(workspace, root, scoped);
81
- return { path: scoped, name: basename(path), ...await readOpenedFile(path) };
78
+ const displayPath = contains(resolve(root), selected) ? toRelative(root, selected) : scoped;
79
+ return { path: displayPath, name: basename(selected), ...await readOpenedFile(path) };
82
80
  }
83
81
  const contents = await readOpenedFile(path);
84
82
  const ticket = randomUUID();
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "superPi": {
4
4
  "managedDirectListener": true
5
5
  },
6
- "version": "0.1.284",
6
+ "version": "0.1.285",
7
7
  "description": "Web control plane and companion for Pi",
8
8
  "license": "MIT",
9
9
  "type": "module",