[PATCH 1 of 1 STABLE] statichttprepo: abort if opener mode is 'r+' or 'rb+'

Adrian Buehlmann adrian at cadifra.com
Thu Feb 17 18:50:11 CST 2011


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1297988341 -3600
# Branch stable
# Node ID c0635917f7aa37a569d140b855869d36e01f3288
# Parent  0b1bbc46516ea3a022f5b9e3893525d7f951b10d
statichttprepo: abort if opener mode is 'r+' or 'rb+'

The old version of the check failed to catch
modifying modes 'r+' and 'rb+'.

diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -71,7 +71,7 @@ def build_opener(ui, authinfo):
         """return a function that opens files over http"""
         p = base
         def o(path, mode="r", atomictemp=None):
-            if 'a' in mode or 'w' in mode:
+            if mode not in ('r', 'rb'):
                 raise IOError('Permission denied')
             f = "/".join((p, urllib.quote(path)))
             return httprangereader(f, urlopener)


More information about the Mercurial-devel mailing list