Skip to content

Commit

Permalink
Minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas-C committed Sep 15, 2023
1 parent 64e42b1 commit 28ee2e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# See https://pre-commit.com/hooks.html for info on hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v4.4.0
hooks:
- id: check-ast
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.13
rev: v1.5.4
hooks:
- id: remove-crlf
- id: remove-tabs
Expand Down
4 changes: 4 additions & 0 deletions image_preview_thumbnailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ def process_link(img_downloader, anchor_tag, url_match, config=PluginConfig()):
resize_as_thumbnail(tmp_thumb_filepath, config.thumb_size)
fs_thumb_filepath = config.fs_thumbs_dir(thumb_filename + img_ext)
os.rename(tmp_thumb_filepath, fs_thumb_filepath)
# Under Windows, I have sometime seen a bit of delay for this operation to be performed,
# which could trigger a FileNotFoundError on the line below, when calling getsize()
if not os.path.getsize(fs_thumb_filepath): # .none file, meaning no thumbnail could be donwloaded
return
rel_thumb_filepath = fs_thumb_filepath.replace(config.output_path + '/', '') if config.output_path else fs_thumb_filepath
Expand Down Expand Up @@ -358,6 +360,8 @@ def register():
except_urls='artvee.com,comicbookplus.com,pxfuel.com,deviantart.com/.+/gallery,artstation.com/[^/]+$',
silent_http_errors=False
))
if html_filepath.startswith("output/"):
config.output_path = "output/"
os.makedirs(config.fs_thumbs_dir(), exist_ok=True)
with nullcontext() if config.cert_verify else warnings.catch_warnings():
if not config.cert_verify:
Expand Down

0 comments on commit 28ee2e4

Please sign in to comment.