mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 02:59:27 +00:00
fixed root folder double slash
This commit is contained in:
@@ -56,6 +56,8 @@ def listfolder(folder: str, title: str):
|
|||||||
subfolders: list[dict] = []
|
subfolders: list[dict] = []
|
||||||
|
|
||||||
foldername = folder.removeprefix(args.root)
|
foldername = folder.removeprefix(args.root)
|
||||||
|
if foldername != "":
|
||||||
|
foldername += "/"
|
||||||
|
|
||||||
if not os.path.exists(os.path.join(args.root, ".thumbnails", foldername)):
|
if not os.path.exists(os.path.join(args.root, ".thumbnails", foldername)):
|
||||||
os.mkdir(os.path.join(args.root, ".thumbnails", foldername))
|
os.mkdir(os.path.join(args.root, ".thumbnails", foldername))
|
||||||
@@ -64,12 +66,14 @@ def listfolder(folder: str, title: str):
|
|||||||
for item in items:
|
for item in items:
|
||||||
if item not in excludes:
|
if item not in excludes:
|
||||||
if os.path.isdir(os.path.join(folder, item)):
|
if os.path.isdir(os.path.join(folder, item)):
|
||||||
subfolder = {"url": f"{args.webroot}{urllib.parse.quote(foldername)}/{urllib.parse.quote(item)}", "name": item}
|
subfolder = {"url": f"{args.webroot}{urllib.parse.quote(foldername)}{urllib.parse.quote(item)}", "name": item}
|
||||||
subfolders.extend([subfolder])
|
subfolders.extend([subfolder])
|
||||||
if item not in notlist:
|
if item not in notlist:
|
||||||
listfolder(os.path.join(folder, item), os.path.join(folder, item).removeprefix(args.root))
|
listfolder(os.path.join(folder, item), os.path.join(folder, item).removeprefix(args.root))
|
||||||
else:
|
else:
|
||||||
baseurl = urllib.parse.quote(foldername) + "/"
|
baseurl = urllib.parse.quote(foldername) + "/"
|
||||||
|
if baseurl == "/":
|
||||||
|
baseurl = ""
|
||||||
extsplit = os.path.splitext(item)
|
extsplit = os.path.splitext(item)
|
||||||
if not args.non_interactive:
|
if not args.non_interactive:
|
||||||
pbar.desc = f"Generating html files - {folder}"
|
pbar.desc = f"Generating html files - {folder}"
|
||||||
|
|||||||
Reference in New Issue
Block a user