Aram created this task.
Aram added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  **Steps to replicate the issue**:
  
  1. Have an article where the references header is the very last line (no 
trailing `\n`).
  2. Example revision: ckbwiki oldid 1575912 
<https://ckb.wikipedia.org/w/api.php?action=query&prop=revisions&revids=1575912&rvprop=content&rvslots=main&format=json>
  3. Run `noreferences.py`.
  
  **What happens?**:
  The bot fails to match the existing header and appends a duplicate section: 
See Diff 
<https://ckb.wikipedia.org/w/index.php?title=%DA%AF%D9%88%D8%AF%DB%8C%D8%A7&diff=next&oldid=1575912>.
  
  **What should have happened instead?**:
  The bot should recognize the header and insert the template inside it.
  
  The current regex in `addReferences` (line 621) is:
  `sectionR = re.compile(fr'\r?\n=+ *{section} *=+ *\r?\n')`
  
  It should allow the end of the string (`$`) if a newline is missing:
  `sectionR = re.compile(fr'\r?\n=+ *{section} *=+ *(?:\r?\n|$)')`

TASK DETAIL
  https://phabricator.wikimedia.org/T424283

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to