Skip to content

Commit

Permalink
fix: encode path
Browse files Browse the repository at this point in the history
  • Loading branch information
jthodge committed Oct 17, 2023
1 parent 5c76ba5 commit b28b92b
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions build_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time

from datetime import timezone
from datasette.utils import tilde_decode, tilde_encode
from datasette.utils import tilde_encode
from sqlite_utils.db import NotFoundError

root = pathlib.Path(__file__).parent.resolve()
Expand Down Expand Up @@ -46,24 +46,9 @@ def build_database(repo_path):
path = str(filepath.relative_to(root))
slug = filepath.stem
url = "https://github.com/jthodge/til/blob/main/{}".format(path)
path_slug = path.replace("/", "_")
path_slug = tilde_encode(path.replace("/", "_"))
topic = path.split("/")[0]

# Log out all of the filepath values above for debugging
print("$" * 80)
print(filepath)
print(fp)
print(title)
print(body)
print(path)
print(slug)
print(url)
print(path_slug)
print("@@" * 40)
print(tilde_encode(path_slug))
print(tilde_decode(path_slug))
print(topic)

try:
row = table.get(path_slug)
previous_body = row["body"]
Expand Down

0 comments on commit b28b92b

Please sign in to comment.