mirror of
https://git.srhtnin.garden/sarah/SaraView.git
synced 2026-10-14 18:38:11 +02:00
Added modals for popups, and fixed root-level bug.
This commit is contained in:
1 parent
9736a55e00
commit
104198036a
11 files changed
+312
-62
No files matched your search
+4
-20
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
from Core import ResolvePath
|
||||
from Core import NormalizeRelativePath, ResolvePath
|
||||
from Explorer import ClassifyFile, ListDirectory
|
||||
from Locks import IsPathAccessible
|
||||
from Preview import ReadTextFile
|
||||
@@ -94,22 +94,6 @@ def _ResolveLocalPortals(Content: str) -> str:
|
||||
return "".join(Output)
|
||||
|
||||
|
||||
def _NormalizeRelativePath(BaseDirectory: str, RawPath: str) -> str:
|
||||
Combined = f"{BaseDirectory}/{RawPath}" if BaseDirectory else RawPath
|
||||
Parts: list[str] = []
|
||||
|
||||
for Part in Combined.split("/"):
|
||||
if Part in ("", "."):
|
||||
continue
|
||||
if Part == "..":
|
||||
if Parts:
|
||||
Parts.pop()
|
||||
continue
|
||||
Parts.append(Part)
|
||||
|
||||
return "/".join(Parts)
|
||||
|
||||
|
||||
def _ReadAccessiblePortalSource(
|
||||
RootName: str, RelativePath: str, Username: str, UserGroups: list[str]
|
||||
) -> str | None:
|
||||
@@ -171,7 +155,7 @@ def _ResolveCrossFileReference(
|
||||
if not PathText:
|
||||
return _FindNamedPortalInDirectory(RootName, RefererDirectory, Name, Username, UserGroups)
|
||||
|
||||
TargetRelativePath = _NormalizeRelativePath(RefererDirectory, PathText)
|
||||
TargetRelativePath = NormalizeRelativePath(RefererDirectory, PathText)
|
||||
|
||||
try:
|
||||
TargetPath = ResolvePath(RootName, TargetRelativePath)
|
||||
@@ -205,7 +189,7 @@ def _ResolveWholeFilePipe(
|
||||
Username: str,
|
||||
UserGroups: list[str],
|
||||
) -> str | None:
|
||||
TargetRelativePath = _NormalizeRelativePath(RefererDirectory, PathText)
|
||||
TargetRelativePath = NormalizeRelativePath(RefererDirectory, PathText)
|
||||
Content = _ReadAccessiblePortalSource(RootName, TargetRelativePath, Username, UserGroups)
|
||||
|
||||
if Content is None:
|
||||
@@ -222,7 +206,7 @@ def _ResolveLineNumberReference(
|
||||
Username: str,
|
||||
UserGroups: list[str],
|
||||
) -> str | None:
|
||||
TargetRelativePath = _NormalizeRelativePath(RefererDirectory, PathText)
|
||||
TargetRelativePath = NormalizeRelativePath(RefererDirectory, PathText)
|
||||
Content = _ReadAccessiblePortalSource(RootName, TargetRelativePath, Username, UserGroups)
|
||||
|
||||
if Content is None:
|
||||
|
||||
Reference in new issue
Block a user