One way to fix it is to change buf.write('|') to buf.write('\Z|') in globs_to_re in copyright.py line 485[1]. The comment at the end of the method sounds like that the thinking had been that in 'foo|bar\Z' the \Z would affect matching of foo but in reality only affects bar.
Other possibility is modifying matches(). In copyright.py line 758, pat.match(filename) could be changed to pat.fullmatch(filename). Then globs_to_re wouldn't need to add \Z even at the end. [1] https://salsa.debian.org/python-debian-team/python-debian/-/blob/e7990d2ab83057a2aaf7851f4250f1072f6fee8c/lib/debian/copyright.py#L485 [2] https://salsa.debian.org/python-debian-team/python-debian/-/blob/master/src/debian/copyright.py#L758 -- Lasse Collin