From 77e9dc6601e6cf21080193d5a78393cfd726f5e1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 14 Jul 2024 20:00:30 +0200 Subject: [PATCH] util.add_url_path --- spcd/util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spcd/util.py b/spcd/util.py index 161cc37..0996c06 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -1,11 +1,18 @@ import os from pathlib import Path +from urllib import urlparse, urlunparse import env from rwx import fs 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: paths = [] for directory, _, files in os.walk(root):