diff --git a/CHANGELOG b/CHANGELOG index c6c7b3d..3b0ac4a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +1.25 +* Fix crash when sending a non existing file + 1.24 * Add /dropautoreact command * Add /listautoreact command diff --git a/debian/changelog b/debian/changelog index 93ecbbd..d87040f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ -localslackirc (1.24-1) UNRELEASED; urgency=medium +localslackirc (1.25-1) UNRELEASED; urgency=medium * New upstream release - -- Salvo 'LtWorf' Tomaselli Mon, 20 Nov 2023 20:06:54 +0100 + -- Salvo 'LtWorf' Tomaselli Mon, 29 Jan 2024 16:08:41 +0100 + +localslackirc (1.24-1) unstable; urgency=low + + * New upstream release + + -- Salvo 'LtWorf' Tomaselli Sat, 02 Dec 2023 16:46:36 +0100 localslackirc (1.23-1) unstable; urgency=low diff --git a/irc.py b/irc.py index 5cf2887..43a2af1 100644 --- a/irc.py +++ b/irc.py @@ -1,5 +1,5 @@ # localslackirc -# Copyright (C) 2018-2023 Salvo "LtWorf" Tomaselli +# Copyright (C) 2018-2024 Salvo "LtWorf" Tomaselli # # localslackirc is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ from diff import seddiff -VERSION = '1.24' +VERSION = '1.25' class IrcDisconnectError(Exception): ... @@ -432,9 +432,12 @@ async def _sendfilehandler(self, cmd: bytes) -> None: await self._sendreply(Replies.ERR_UNKNOWNCOMMAND, 'Syntax: /sendfile #channel filename') return - with open(filename, 'rb') as f: - content = f.read() - await self.send_file(params[1], content=content, filename=filename) + try: + with open(filename, 'rb') as f: + content = f.read() + await self.send_file(params[1], content=content, filename=filename) + except Exception as e: + await self._sendreply(Replies.ERR_FILEERROR, f'Error: {e}') async def send_file(self, bchannel_name: bytes, content: bytes, filename: str) -> bool: