From 709a4e51badd5d644b4e1c0af71c06431ba87b9f Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 18 Jun 2023 11:16:50 +0200 Subject: [PATCH 1/5] Testrun --- setup.cfg | 4 +- test/Calibre-Web TestSummary_Linux.html | 213 +++++++++++++++--------- 2 files changed, 136 insertions(+), 81 deletions(-) diff --git a/setup.cfg b/setup.cfg index 5bf940bd..28357854 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,8 +67,8 @@ gdrive = httplib2>=0.9.2,<0.23.0 oauth2client>=4.0.0,<4.1.4 uritemplate>=3.0.0,<4.2.0 - pyasn1-modules>=0.0.8,<0.3.0 - pyasn1>=0.1.9,<0.5.0 + pyasn1-modules>=0.0.8,<0.4.0 + pyasn1>=0.1.9,<0.6.0 PyDrive2>=1.3.1,<1.16.0 PyYAML>=3.12 rsa>=3.4.2,<4.10.0 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index a67aac78..84269b08 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2023-05-27 20:05:01

+

Start Time: 2023-06-17 19:25:53

-

Stop Time: 2023-05-28 03:05:40

+

Stop Time: 2023-06-18 01:51:18

-

Duration: 5h 54 min

+

Duration: 5h 25 min

@@ -471,15 +471,15 @@ - + TestCli - 12 - 11 - 1 + 13 + 13 + 0 0 0 - Detail + Detail @@ -503,33 +503,11 @@ - +
TestCli - test_change_password
- -
- FAIL -
- - - - + PASS @@ -590,7 +568,7 @@ AssertionError: [] is not true -
TestCli - test_no_database
+
TestCli - test_logfile
PASS @@ -599,7 +577,7 @@ AssertionError: [] is not true -
TestCli - test_settingsdb_not_writeable
+
TestCli - test_no_database
PASS @@ -607,6 +585,15 @@ AssertionError: [] is not true + +
TestCli - test_settingsdb_not_writeable
+ + PASS + + + + +
TestCli - test_writeonly_static_files
@@ -1197,13 +1184,13 @@ AssertionError: [] is not true TestEditBooks - 36 + 37 35 0 0 - 1 + 2 - Detail + Detail @@ -1382,7 +1369,7 @@ AssertionError: [] is not true -
TestEditBooks - test_rename_uppercase_lowercase
+
TestEditBooks - test_rename_upper_lowercase
@@ -1395,6 +1382,32 @@ AssertionError: [] is not true onclick="document.getElementById('div_st13.20').style.display='none'">
+
+
For some reason it works, but during test it fails, only if executed in debugger it works
+
+
+ + + + + + + + + +
TestEditBooks - test_rename_uppercase_lowercase
+ + +
+ SKIP +
+ + From 63b7d70f335cc509408ba8098004eebb5ec74879 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 25 Jun 2023 14:39:45 +0200 Subject: [PATCH 2/5] Update optional requirements Update to be compatible with comicapi 3.2 --- cps/comic.py | 17 +++++++++++++++-- cps/uploader.py | 8 ++++---- optional-requirements.txt | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/cps/comic.py b/cps/comic.py index 907614c9..13774756 100644 --- a/cps/comic.py +++ b/cps/comic.py @@ -36,6 +36,12 @@ try: from comicapi import __version__ as comic_version except ImportError: comic_version = '' + try: + from comicapi.comicarchive import load_archive_plugins + import comicapi.utils + comicapi.utils.add_rar_paths() + except ImportError: + load_archive_plugins = None except (ImportError, LookupError) as e: log.debug('Cannot import comicapi, extracting comic metadata will not work: %s', e) import zipfile @@ -88,7 +94,10 @@ def _extract_cover_from_archive(original_file_extension, tmp_file_name, rar_exec def _extract_cover(tmp_file_name, original_file_extension, rar_executable): cover_data = extension = None if use_comic_meta: - archive = ComicArchive(tmp_file_name, rar_exe_path=rar_executable) + try: + archive = ComicArchive(tmp_file_name, rar_exe_path=rar_executable) + except TypeError: + archive = ComicArchive(tmp_file_name) name_list = archive.getPageNameList if hasattr(archive, "getPageNameList") else archive.get_page_name_list for index, name in enumerate(name_list()): ext = os.path.splitext(name) @@ -105,7 +114,11 @@ def _extract_cover(tmp_file_name, original_file_extension, rar_executable): def get_comic_info(tmp_file_path, original_file_name, original_file_extension, rar_executable): if use_comic_meta: - archive = ComicArchive(tmp_file_path, rar_exe_path=rar_executable) + try: + archive = ComicArchive(tmp_file_path, rar_exe_path=rar_executable) + except TypeError: + load_archive_plugins(force=True, rar=rar_executable) + archive = ComicArchive(tmp_file_path) if hasattr(archive, "seemsToBeAComicArchive"): seems_archive = archive.seemsToBeAComicArchive else: diff --git a/cps/uploader.py b/cps/uploader.py index 3cd7b21a..42b776aa 100644 --- a/cps/uploader.py +++ b/cps/uploader.py @@ -69,7 +69,7 @@ except ImportError as e: use_fb2_meta = False -def process(tmp_file_path, original_file_name, original_file_extension, rarExecutable): +def process(tmp_file_path, original_file_name, original_file_extension, rar_executable): meta = default_meta(tmp_file_path, original_file_name, original_file_extension) extension_upper = original_file_extension.upper() try: @@ -83,7 +83,7 @@ def process(tmp_file_path, original_file_name, original_file_extension, rarExecu meta = comic.get_comic_info(tmp_file_path, original_file_name, original_file_extension, - rarExecutable) + rar_executable) except Exception as ex: log.warning('cannot parse metadata, using default: %s', ex) @@ -248,7 +248,7 @@ def get_magick_version(): return ret -def upload(uploadfile, rarExcecutable): +def upload(uploadfile, rar_excecutable): tmp_dir = os.path.join(gettempdir(), 'calibre_web') if not os.path.isdir(tmp_dir): @@ -260,4 +260,4 @@ def upload(uploadfile, rarExcecutable): tmp_file_path = os.path.join(tmp_dir, md5) log.debug("Temporary file: %s", tmp_file_path) uploadfile.save(tmp_file_path) - return process(tmp_file_path, filename_root, file_extension, rarExcecutable) + return process(tmp_file_path, filename_root, file_extension, rar_excecutable) diff --git a/optional-requirements.txt b/optional-requirements.txt index 5714ac88..ff02d04f 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -38,7 +38,7 @@ faust-cchardet>=2.1.18 # Comics natsort>=2.2.0,<8.4.0 -comicapi>=2.2.0,<2.3.0 +comicapi>=2.2.0,<3.3.0 # Kobo integration jsonschema>=3.2.0,<4.18.0 From 3f5583017f769b0f8b636939e32c10be770dd8d2 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 9 Jul 2023 10:00:54 +0200 Subject: [PATCH 3/5] Improved pathchooser --- cps/admin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cps/admin.py b/cps/admin.py index 82fc196e..a1b65640 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -33,6 +33,7 @@ from functools import wraps from urllib.parse import urlparse from flask import Blueprint, flash, redirect, url_for, abort, request, make_response, send_from_directory, g, Response +from flask import Markup from flask_login import login_required, current_user, logout_user from flask_babel import gettext as _ from flask_babel import get_locale, format_time, format_datetime, format_timedelta @@ -1035,7 +1036,8 @@ def pathchooser(): for f in folders: try: - data = {"name": f, "fullpath": os.path.join(cwd, f)} + sanitized_f = str(Markup.escape(f)) + data = {"name": sanitized_f, "fullpath": os.path.join(cwd, sanitized_f)} data["sort"] = data["fullpath"].lower() except Exception: continue From 7b321d63c162defc0da28cbd83bd392b530a8c05 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 23 Jul 2023 18:57:10 +0200 Subject: [PATCH 4/5] update testresults --- setup.cfg | 2 +- test/Calibre-Web TestSummary_Linux.html | 1345 +++++++++++++---------- 2 files changed, 788 insertions(+), 559 deletions(-) diff --git a/setup.cfg b/setup.cfg index 28357854..b445eb5e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -94,7 +94,7 @@ metadata = faust-cchardet>=2.1.18 comics = natsort>=2.2.0,<8.4.0 - comicapi>=2.2.0,<2.3.0 + comicapi>=2.2.0,<3.3.0 kobo = jsonschema>=3.2.0,<4.18.0 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 84269b08..be34daaf 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2023-06-17 19:25:53

+

Start Time: 2023-06-25 20:35:52

-

Stop Time: 2023-06-18 01:51:18

+

Stop Time: 2023-06-26 03:03:00

-

Duration: 5h 25 min

+

Duration: 5h 27 min

@@ -447,13 +447,13 @@ - + TestBackupMetadataGdrive 1 + 0 + 0 1 0 - 0 - 0 Detail @@ -461,11 +461,203 @@ - +
TestBackupMetadataGdrive - test_backup_gdrive
- PASS + +
+ ERROR +
+ + + + + + + + + + + _ErrorHolder + 1 + 0 + 0 + 1 + 0 + + Detail + + + + + + + +
tearDownClass (test_backup_metadata_gdrive)
+ + +
+ ERROR +
+ + + + @@ -479,13 +671,13 @@ 0 0 - Detail + Detail - +
TestCli - test_already_started
@@ -494,7 +686,7 @@ - +
TestCli - test_bind_to_single_interface
@@ -503,7 +695,7 @@ - +
TestCli - test_change_password
@@ -512,7 +704,7 @@ - +
TestCli - test_cli_SSL_files
@@ -521,7 +713,7 @@ - +
TestCli - test_cli_different_folder
@@ -530,7 +722,7 @@ - +
TestCli - test_cli_different_settings_database
@@ -539,7 +731,7 @@ - +
TestCli - test_dryrun_update
@@ -548,7 +740,7 @@ - +
TestCli - test_enable_reconnect
@@ -557,7 +749,7 @@ - +
TestCli - test_environ_port_setting
@@ -566,7 +758,7 @@ - +
TestCli - test_logfile
@@ -575,7 +767,7 @@ - +
TestCli - test_no_database
@@ -584,7 +776,7 @@ - +
TestCli - test_settingsdb_not_writeable
@@ -593,7 +785,7 @@ - +
TestCli - test_writeonly_static_files
@@ -611,13 +803,13 @@ 0 0 - Detail + Detail - +
TestCliGdrivedb - test_cli_gdrive_folder
@@ -626,7 +818,7 @@ - +
TestCliGdrivedb - test_cli_gdrive_location
@@ -635,7 +827,7 @@ - +
TestCliGdrivedb - test_gdrive_db_nonwrite
@@ -644,7 +836,7 @@ - +
TestCliGdrivedb - test_no_database
@@ -662,13 +854,13 @@ 0 0 - Detail + Detail - +
TestCoverEditBooks - test_invalid_jpg_hdd
@@ -677,7 +869,7 @@ - +
TestCoverEditBooks - test_upload_jpg
@@ -695,13 +887,13 @@ 0 0 - Detail + Detail - +
TestDeleteDatabase - test_delete_books_in_database
@@ -719,13 +911,13 @@ 0 0 - Detail + Detail - +
TestEbookConvertCalibre - test_calibre_log
@@ -734,7 +926,7 @@ - +
TestEbookConvertCalibre - test_convert_deactivate
@@ -743,7 +935,7 @@ - +
TestEbookConvertCalibre - test_convert_email
@@ -752,7 +944,7 @@ - +
TestEbookConvertCalibre - test_convert_failed_and_email
@@ -761,7 +953,7 @@ - +
TestEbookConvertCalibre - test_convert_only
@@ -770,7 +962,7 @@ - +
TestEbookConvertCalibre - test_convert_options
@@ -779,7 +971,7 @@ - +
TestEbookConvertCalibre - test_convert_parameter
@@ -788,7 +980,7 @@ - +
TestEbookConvertCalibre - test_convert_wrong_excecutable
@@ -797,7 +989,7 @@ - +
TestEbookConvertCalibre - test_convert_xss
@@ -806,7 +998,7 @@ - +
TestEbookConvertCalibre - test_email_failed
@@ -815,7 +1007,7 @@ - +
TestEbookConvertCalibre - test_email_only
@@ -824,7 +1016,7 @@ - +
TestEbookConvertCalibre - test_kindle_send_not_configured
@@ -833,7 +1025,7 @@ - +
TestEbookConvertCalibre - test_ssl_smtp_setup_error
@@ -842,7 +1034,7 @@ - +
TestEbookConvertCalibre - test_starttls_smtp_setup_error
@@ -851,7 +1043,7 @@ - +
TestEbookConvertCalibre - test_user_convert_xss
@@ -869,13 +1061,13 @@ 0 0 - Detail + Detail - +
TestEbookConvertCalibreGDrive - test_convert_email
@@ -884,7 +1076,7 @@ - +
TestEbookConvertCalibreGDrive - test_convert_failed_and_email
@@ -893,7 +1085,7 @@ - +
TestEbookConvertCalibreGDrive - test_convert_only
@@ -902,7 +1094,7 @@ - +
TestEbookConvertCalibreGDrive - test_convert_parameter
@@ -911,7 +1103,7 @@ - +
TestEbookConvertCalibreGDrive - test_email_failed
@@ -920,7 +1112,7 @@ - +
TestEbookConvertCalibreGDrive - test_email_only
@@ -938,13 +1130,13 @@ 0 0 - Detail + Detail - +
TestEbookConvertKepubify - test_convert_deactivate
@@ -953,7 +1145,7 @@ - +
TestEbookConvertKepubify - test_convert_only
@@ -962,7 +1154,7 @@ - +
TestEbookConvertKepubify - test_convert_wrong_excecutable
@@ -980,13 +1172,13 @@ 0 0 - Detail + Detail - +
TestEbookConvertGDriveKepubify - test_convert_deactivate
@@ -995,7 +1187,7 @@ - +
TestEbookConvertGDriveKepubify - test_convert_only
@@ -1004,7 +1196,7 @@ - +
TestEbookConvertGDriveKepubify - test_convert_wrong_excecutable
@@ -1022,13 +1214,13 @@ 0 1 - Detail + Detail - +
TestEditAdditionalBooks - test_cbz_comicinfo
@@ -1037,7 +1229,7 @@ - +
TestEditAdditionalBooks - test_change_upload_formats
@@ -1046,7 +1238,7 @@ - +
TestEditAdditionalBooks - test_delete_book
@@ -1055,7 +1247,7 @@ - +
TestEditAdditionalBooks - test_delete_role
@@ -1064,7 +1256,7 @@ - +
TestEditAdditionalBooks - test_details_popup
@@ -1073,7 +1265,7 @@ - +
TestEditAdditionalBooks - test_edit_book_identifier
@@ -1082,7 +1274,7 @@ - +
TestEditAdditionalBooks - test_edit_book_identifier_capital
@@ -1091,7 +1283,7 @@ - +
TestEditAdditionalBooks - test_edit_book_identifier_standard
@@ -1100,7 +1292,7 @@ - +
TestEditAdditionalBooks - test_edit_special_book_identifier
@@ -1109,7 +1301,7 @@ - +
TestEditAdditionalBooks - test_title_sort
@@ -1118,7 +1310,7 @@ - +
TestEditAdditionalBooks - test_upload_cbz_coverformats
@@ -1127,7 +1319,7 @@ - +
TestEditAdditionalBooks - test_upload_edit_role
@@ -1136,7 +1328,7 @@ - +
TestEditAdditionalBooks - test_upload_metadata_cbr
@@ -1145,7 +1337,7 @@ - +
TestEditAdditionalBooks - test_upload_metadata_cbt
@@ -1154,7 +1346,7 @@ - +
TestEditAdditionalBooks - test_xss_author_edit
@@ -1163,7 +1355,7 @@ - +
TestEditAdditionalBooks - test_xss_comment_edit
@@ -1172,7 +1364,7 @@ - +
TestEditAdditionalBooks - test_xss_custom_comment_edit
@@ -1190,13 +1382,13 @@ 0 2 - Detail + Detail - +
TestEditBooks - test_download_book
@@ -1205,7 +1397,7 @@ - +
TestEditBooks - test_edit_author
@@ -1214,7 +1406,7 @@ - +
TestEditBooks - test_edit_category
@@ -1223,7 +1415,7 @@ - +
TestEditBooks - test_edit_comments
@@ -1232,7 +1424,7 @@ - +
TestEditBooks - test_edit_custom_bool
@@ -1241,7 +1433,7 @@ - +
TestEditBooks - test_edit_custom_categories
@@ -1250,7 +1442,7 @@ - +
TestEditBooks - test_edit_custom_comment
@@ -1259,7 +1451,7 @@ - +
TestEditBooks - test_edit_custom_date
@@ -1268,7 +1460,7 @@ - +
TestEditBooks - test_edit_custom_float
@@ -1277,7 +1469,7 @@ - +
TestEditBooks - test_edit_custom_int
@@ -1286,7 +1478,7 @@ - +
TestEditBooks - test_edit_custom_rating
@@ -1295,7 +1487,7 @@ - +
TestEditBooks - test_edit_custom_single_select
@@ -1304,7 +1496,7 @@ - +
TestEditBooks - test_edit_custom_text
@@ -1313,7 +1505,7 @@ - +
TestEditBooks - test_edit_language
@@ -1322,7 +1514,7 @@ - +
TestEditBooks - test_edit_publisher
@@ -1331,7 +1523,7 @@ - +
TestEditBooks - test_edit_publishing_date
@@ -1340,7 +1532,7 @@ - +
TestEditBooks - test_edit_rating
@@ -1349,7 +1541,7 @@ - +
TestEditBooks - test_edit_series
@@ -1358,7 +1550,7 @@ - +
TestEditBooks - test_edit_title
@@ -1367,19 +1559,19 @@ - +
TestEditBooks - test_rename_upper_lowercase
- SKIP + SKIP
-