diff --git a/CHANGELOG.md b/CHANGELOG.md index f59dc8a..818ab54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.10.7] - 2026-09-17 + +### Fixed +- **createTorrentSum**: Corregido error (`OSError: [Errno 22] Invalid argument`) al calcular la suma de verificación MD5 de los ficheros de imagen cuando estos ocupan menos de 1 MB, ajustando dinámicamente el `seek_offset` al tamaño real del fichero. + ## [0.10.6] - 2026-07-27 ### Added diff --git a/bin/createTorrentSum.py b/bin/createTorrentSum.py index 766f53e..e75dffa 100644 --- a/bin/createTorrentSum.py +++ b/bin/createTorrentSum.py @@ -96,8 +96,13 @@ def get_md5_sum(file_path, megabytes=1): Se utiliza para crear el archivo ".sum" (para transferencias Unicast y Multicast). """ hash_md5 = hashlib.md5() + file_size = os.path.getsize(file_path) + seek_offset = -megabytes * 1024 * 1024 + if file_size < (-seek_offset): + seek_offset = -file_size + with open(file_path, "rb") as f: - f.seek(-megabytes * 1024 * 1024, os.SEEK_END) + f.seek(seek_offset, os.SEEK_END) data = f.read(megabytes * 1024 * 1024) hash_md5.update(data) return hash_md5.hexdigest()