Skip to content

Commit

Permalink
fix #330
Browse files Browse the repository at this point in the history
  • Loading branch information
RicterZ committed Sep 21, 2024
1 parent 0ed5fa1 commit b51e812
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nhentai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import shutil
import requests
import sqlite3
import urllib.parse

from nhentai import constant
from nhentai.logger import logger
Expand Down Expand Up @@ -148,7 +149,7 @@ def generate_main_html(output_dir='./'):
else:
title = 'nHentai HTML Viewer'

image_html += element.format(FOLDER=folder, IMAGE=image, TITLE=title)
image_html += element.format(FOLDER=urllib.parse.quote(folder), IMAGE=image, TITLE=title)
if image_html == '':
logger.warning('No index.html found, --gen-main paused.')
return
Expand All @@ -158,7 +159,8 @@ def generate_main_html(output_dir='./'):
f.write(data.encode('utf-8'))
shutil.copy(os.path.dirname(__file__) + '/viewer/logo.png', './')
set_js_database()
logger.log(16, f'Main Viewer has been written to "{output_dir}main.html"')
output_dir = output_dir[:-1] if output_dir.endswith('/') else output_dir
logger.log(16, f'Main Viewer has been written to "{output_dir}/main.html"')
except Exception as e:
logger.warning(f'Writing Main Viewer failed ({e})')

Expand Down

0 comments on commit b51e812

Please sign in to comment.