FilePage.__init__ should raise when the title does not have a valid file extension.
original report
When a # character is present when setting the title of a FilePage object, the resultant FilePage's title mysteriously loses the space character that was preceding the #. This caused me to upload files to incorrect titles. See test code:
title = 'Front_Cover_Album_#3_-_DPLA_-_e0ff466e4c02b7ee526863936a6f1512_(page_2).jpg' site = pywikibot.Site() testpage = pywikibot.Page(site, title=title) testfile = pywikibot.FilePage(site, title=title) print('Title: ' + title) print('Test: ' + testfile.title())
Output:
Title: Front_Cover_Album_#3_-_DPLA_-_e0ff466e4c02b7ee526863936a6f1512_(page_2).jpg Test: File:Front Cover Album#3 - DPLA - e0ff466e4c02b7ee526863936a6f1512 (page 2).jpg