Commit b0cdca15 authored by Sidnei da Silva's avatar Sidnei da Silva

parent 68990e0f
...@@ -18,6 +18,9 @@ Zope Changes ...@@ -18,6 +18,9 @@ Zope Changes
Bugs Fixed Bugs Fixed
- Usage of 'urljoin' in 'webdav.davcmds' could lead to wrongly
constructed urls.
- Fix #2141: TALES doesn't traverse correctly over 'repeat' - Fix #2141: TALES doesn't traverse correctly over 'repeat'
variable variable
......
...@@ -42,6 +42,11 @@ def absattr(attr): ...@@ -42,6 +42,11 @@ def absattr(attr):
return attr() return attr()
return attr return attr
def urljoin(url, s):
url = url.rstrip('/')
s = s.lstrip('/')
return '/'.join((url, s))
def urlfix(url, s): def urlfix(url, s):
n=len(s) n=len(s)
if url[-n:]==s: url=url[:-n] if url[-n:]==s: url=url[:-n]
......
...@@ -23,10 +23,9 @@ import transaction ...@@ -23,10 +23,9 @@ import transaction
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Acquisition import aq_parent from Acquisition import aq_parent
from OFS.PropertySheets import DAVProperties from OFS.PropertySheets import DAVProperties
from ZConfig.url import urljoin
from zExceptions import BadRequest, Forbidden from zExceptions import BadRequest, Forbidden
from common import absattr, aq_base, urlfix, urlbase from common import absattr, aq_base, urlfix, urlbase, urljoin
from common import isDavCollection from common import isDavCollection
from common import PreconditionFailed from common import PreconditionFailed
from interfaces import IWriteLock from interfaces import IWriteLock
...@@ -170,8 +169,8 @@ class PropFind: ...@@ -170,8 +169,8 @@ class PropFind:
if dflag: if dflag:
ob._p_deactivate() ob._p_deactivate()
elif hasattr(ob, '__dav_resource__'): elif hasattr(ob, '__dav_resource__'):
uri=urljoin(url, absattr(ob.id)) uri = urljoin(url, absattr(ob.getId()))
depth=depth=='infinity' and depth or 0 depth = depth=='infinity' and depth or 0
self.apply(ob, uri, depth, result, top=0) self.apply(ob, uri, depth, result, top=0)
if dflag: if dflag:
ob._p_deactivate() ob._p_deactivate()
...@@ -409,7 +408,7 @@ class Lock: ...@@ -409,7 +408,7 @@ class Lock:
if depth == 'infinity' and iscol: if depth == 'infinity' and iscol:
for ob in obj.objectValues(): for ob in obj.objectValues():
if hasattr(obj, '__dav_resource__'): if hasattr(obj, '__dav_resource__'):
uri = urljoin(url, absattr(ob.id)) uri = urljoin(url, absattr(ob.getId()))
self.apply(ob, creator, depth, token, result, self.apply(ob, creator, depth, token, result,
uri, top=0) uri, top=0)
if not top: if not top:
...@@ -474,7 +473,7 @@ class Unlock: ...@@ -474,7 +473,7 @@ class Unlock:
if hasattr(ob, '__dav_resource__') and \ if hasattr(ob, '__dav_resource__') and \
(IWriteLock.providedBy(ob) or (IWriteLock.providedBy(ob) or
WriteLockInterface.isImplementedBy(ob)): WriteLockInterface.isImplementedBy(ob)):
uri = urljoin(url, absattr(ob.id)) uri = urljoin(url, absattr(ob.getId()))
self.apply(ob, token, uri, result, top=0) self.apply(ob, token, uri, result, top=0)
if not top: if not top:
return result return result
...@@ -529,7 +528,7 @@ class DeleteCollection: ...@@ -529,7 +528,7 @@ class DeleteCollection:
for ob in obj.objectValues(): for ob in obj.objectValues():
dflag = hasattr(ob,'_p_changed') and (ob._p_changed == None) dflag = hasattr(ob,'_p_changed') and (ob._p_changed == None)
if hasattr(ob, '__dav_resource__'): if hasattr(ob, '__dav_resource__'):
uri = urljoin(url, absattr(ob.id)) uri = urljoin(url, absattr(ob.getId()))
self.apply(ob, token, user, uri, result, top=0) self.apply(ob, token, user, uri, result, top=0)
if dflag: if dflag:
ob._p_deactivate() ob._p_deactivate()
......
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