util.add_url_path

This commit is contained in:
Marc Beninca 2024-07-14 20:00:30 +02:00
parent 678d9e0e4d
commit 77e9dc6601
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -1,11 +1,18 @@
import os import os
from pathlib import Path from pathlib import Path
from urllib import urlparse, urlunparse
import env import env
from rwx import fs from rwx import fs
from rwx.log import stream as log from rwx.log import stream as log
def add_url_path(url: str, extra_path: str) -> str:
parts = urlparse(url)
parts._replace(path=Path(parts.path) / extra_path)
return urlunparse(parts)
def browse(root: str) -> None: def browse(root: str) -> None:
paths = [] paths = []
for directory, _, files in os.walk(root): for directory, _, files in os.walk(root):