Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
fc854abd
Commit
fc854abd
authored
Feb 19, 2006
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Collector #1991: ZPublisher did not deal properly with a trailing %20 in the URL
parent
5064e0be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
2 deletions
+65
-2
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/ZPublisher/Publish.py
lib/python/ZPublisher/Publish.py
+3
-2
lib/python/ZPublisher/tests/testPublish.py
lib/python/ZPublisher/tests/testPublish.py
+59
-0
No files found.
doc/CHANGES.txt
View file @
fc854abd
...
...
@@ -197,6 +197,9 @@ Zope Changes
Bugs Fixed
- Collector #1991: ZPublisher did not deal properly with a trailing
%20 in the URL
- zope.app.introspector was not included with the source archive
- Collector #2013: improved XHTML conformance of error messages,
...
...
lib/python/ZPublisher/Publish.py
View file @
fc854abd
...
...
@@ -93,8 +93,9 @@ def publish(request, module_name, after_list, debug=0,
if
bobo_before
is
not
None
:
bobo_before
()
# Get a nice clean path list:
path
=
request_get
(
'PATH_INFO'
).
strip
()
# Get the path list.
# According to RFC1738 a trailing space in the path is valid.
path
=
request_get
(
'PATH_INFO'
)
request
[
'PARENTS'
]
=
parents
=
[
object
]
...
...
lib/python/ZPublisher/tests/testPublish.py
View file @
fc854abd
...
...
@@ -266,6 +266,65 @@ def testPublisher():
"""
pass
class
ObjectNotFound
:
"""Mock object for traversing to.
"""
def
__call__
(
self
):
tracer
.
append
(
'ObjectNotFound'
)
return
'ObjectNotFound'
class
PathRequest
(
Request
):
def
__init__
(
self
,
path
):
self
.
PATH_INFO
=
path
Request
.
__init__
(
self
)
def
get
(
self
,
a
,
b
=
''
):
if
a
==
'PATH_INFO'
:
return
self
.
PATH_INFO
else
:
return
''
def
traverse
(
self
,
path
,
validated_hook
):
if
path
==
self
.
PATH_INFO
:
return
Object
()
else
:
return
ObjectNotFound
()
def
testPublishPath
():
"""
Tests to ensure that publish passes paths through to the request without
stripping spaces (as this can lead to google indexing pages with a trailing
space when someone has a typo in an href to you're site). Zope bug #1991.
>>> from ZPublisher.Publish import publish
Without the trailing space, should work normally
>>> tracer.reset()
>>> request = PathRequest('/foo')
>>> response = publish(request, module_name, after_list)
>>> tracer.showTracedPath()
begin
__call__
commit
Now with a trailing space, should also work normally, but in zope 2.9.0
and earlier publish did a strip() on the path so instead of __call__ you
an ObjectNotFound in the trace.
>>> tracer.reset()
>>> request = PathRequest('/foo ')
>>> response = publish(request, module_name, after_list)
>>> tracer.showTracedPath()
begin
__call__
commit
"""
pass
from
zope.testing
import
doctest
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment