Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
h1-the-swan committed Dec 16, 2023
1 parent 30ad8d8 commit 7cd0bd9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 66 deletions.
1 change: 1 addition & 0 deletions backend/mydiary/joplin_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ def create_thumbnail(
image_bytes = reduce_size_recurse(image_bytes, size, bytes_threshold)
r = self.create_resource(data=image_bytes, title=name)
r.raise_for_status()
# if failed, need to run self.delete_resource(hash)
if session is None:
session = self.new_session()
resource_id = r.json()["id"]
Expand Down
4 changes: 4 additions & 0 deletions backend/mydiary/nextcloud_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def parse_datetime_from_filepath(
filepath = requests.utils.unquote(filepath)
name = Path(filepath).stem
# name will look like: "22-06-11 17-50-16 4704"
# I've encountered a weird one: "23-12-10 11-38-04 zed_"
# let's deal with that case:
if not name[-4:].isnumeric():
name = f"{name[:-4]}0000"
return pendulum.from_format(name, "YY-MM-DD HH-mm-ss SSSS", tz=tz)

def get_mimetype_type(self, xml_item) -> str:
Expand Down
Loading

0 comments on commit 7cd0bd9

Please sign in to comment.