Commit 095fbe8e by murtaugh

fixed an overly greedy regular expression in fixfilelinks

parent 2b47fbaf
......@@ -24,7 +24,7 @@ def fixurlfilelinks (src, wiki, timestamp=None, phpuploader=None, user=None):
return "[[{0}{1}]]".format(, or "")
return re.sub(r"\[\[(?:File|Fichier|Image)\:(https?\://.+?)(\|.+)?\]\]", linksub, src)
return re.sub(r"\[\[(?:File|Fichier|Image)\:(https?\://.+?)(\|.*?)?\]\]", linksub, src)
def fixlinks (page, wiki, phpuploader=None, user=None):
print ("fixlinks {0}".format(, file=sys.stderr)
url = ""
import re
from urllib.request import Request, urlopen
with open("m/scripts/mediawikifixbrokenfilelinks.test.txt") as f:
src =
print (re.sub(r"\[\[(?:File|Fichier|Image)\:(https?\://.+?)(\|.*?)?\]\]", "*", src))
# f = urlopen(url)
f = Request(url, headers={'User-Agent': 'Mozilla/5.0'})
print (f)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment