mirror of
https://github.com/tiennm99/telegram-exporter.git
synced 2026-10-11 03:13:49 +00:00
Third slice: verify-export.sh, without the subprocess or the python. One rclone listing builds an in-memory index, and the report is computed from it. missing-ids.txt and gap.json are gone; so is every python3 heredoc. Presence is answered from a whole name and never from a message id. The id-keyed map exists only to tell "absent" apart from "absent, but a stale copy under an older name is sitting there", and it stays unexported so nothing can reach for it as an answer. That distinction is the bug this rewrite exists to remove, so it is enforced by structure rather than by comment. Names are checked for path containment before use. Storing them verbatim means a filename chosen by whoever uploaded the file can contain a separator or a parent reference, and tdl never had to care because its template rewrote those away. Over-long names are refused for the same reason: the filesystem would reject them at create time, and a file that can never be written would be reported absent on every pass forever. Objects are addressed by the path rclone knows them by, not by the basename used for matching. The two differ once a remote has directory structure, and deleting by basename would miss the object or remove a same-named one from the root. Basenames appearing at more than one path make the snapshot ambiguous, so they are reported rather than silently resolved. Indexing runs at full depth with filters cleared. Inheriting RCLONE_MAX_DEPTH or RCLONE_EXCLUDE would not fail, it would quietly report archived files as absent and fetch them all again. Deleting stale copies stays opt-in and confirmed; a non-interactive stdin declines rather than proceeding. Filenames are quoted wherever they are printed, so an embedded escape cannot redraw the list an operator approves. Verified against the live remote: identical to verify-export.sh on the same state — 18155 expected, 15548 present, 2607 absent, ids 9857-18013, exit 1.