changes
All checks were successful
Build Org Website / build (push) Successful in 52s

This commit is contained in:
2026-05-07 16:21:41 +01:00
parent 3d87e3d1e8
commit c65df7d95a
17 changed files with 140 additions and 81 deletions

View File

@@ -14,10 +14,14 @@ class AuthoringServerTestCase(unittest.TestCase):
self.blogs = self.root / "blogs"
self.posts = self.root / "posts"
self.lima = self.root / "lima"
self.home = self.root / "home"
self.tags = self.root / "tags"
self.hzone = self.root / "assets" / "images" / "hzone"
self.blogs.mkdir()
self.posts.mkdir()
self.lima.mkdir()
self.home.mkdir()
self.tags.mkdir()
patches = {
"ROOT": self.root,
@@ -71,9 +75,13 @@ class UtilityTests(AuthoringServerTestCase):
server.safe_relative_path("lima/index.md"),
self.lima / "index.md",
)
self.assertEqual(
server.safe_relative_path("home/notes.org"),
self.home / "notes.org",
)
def test_safe_relative_path_rejects_escapes_and_wrong_locations(self):
for path in ("../secret.org", "/tmp/secret.org", "sitemap.org", "lima/index.org"):
for path in ("../secret.org", "/tmp/secret.org", "sitemap.org", "assets/style.org", "tags/life.org"):
with self.subTest(path=path):
with self.assertRaises(ValueError):
server.safe_relative_path(path)
@@ -156,10 +164,12 @@ class PageRenderingTests(AuthoringServerTestCase):
(self.posts / "posts-list.org").write_text("#+TITLE: Generated\n", encoding="utf-8")
(self.blogs / "note.sync-conflict-1.org").write_text("#+TITLE: Conflict\n", encoding="utf-8")
(self.lima / "index.md").write_text("# Lima Home\n", encoding="utf-8")
(self.home / "notes.org").write_text("#+TITLE: Notes\n", encoding="utf-8")
(self.tags / "life.org").write_text("#+TITLE: Tag\n", encoding="utf-8")
paths = [page["path"] for page in server.list_pages()]
self.assertEqual(set(paths), {"blogs/keep.org", "lima/index.md"})
self.assertEqual(set(paths), {"blogs/keep.org", "home/notes.org", "lima/index.md"})
def test_relative_asset_path_is_calculated_from_lima_page_directory(self):
self.assertEqual(