Edgewall Software
Modify

Opened 2 weeks ago

Closed 9 days ago

#13794 closed defect (fixed)

encoding error in diff

Reported by: Dirk Stöcker Owned by: Jun Omae
Priority: normal Milestone: 1.6.1
Component: version control Version: 1.6
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed diff view to send bytes instance and TypeError not raises when term parameter is missing.

API Changes:
Internal Changes:

Description

As I now grep the log for ValueError for #13792 following came up:

2024-10-10 15:18:28,643 Trac[main] ERROR: [177.55.179.253] Internal Server Error: <RequestWithSession "GET '/diff?term=%2Fjosm%2FTrunks%20'">, referrer 'https://josm.openstreetmap.de/diff?new_path=%2Fjosm%2Ftrunk&old_path=%2Fjosm%2Ftrunk&new_rev=&old_rev='
Traceback (most recent call last):Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/trac/web/main.py", line 609, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python3.10/dist-packages/trac/web/main.py", line 301, in dispatch
    raise e
  File "/usr/local/lib/python3.10/dist-packages/trac/web/main.py", line 247, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python3.10/dist-packages/trac/versioncontrol/web_ui/changeset.py", line 1200, in process_request
    req.send(content, 'application/json', 200)
  File "/usr/local/lib/python3.10/dist-packages/trac/web/api.py", line 879, in send
    self._send(content, content_type, status)
  File "/usr/local/lib/python3.10/dist-packages/trac/web/api.py", line 1015, in _send
    self.write(content)
  File "/usr/local/lib/python3.10/dist-packages/trac/web/api.py", line 975, in write
    raise ValueError("Can't send str content")
ValueError: Can't send str content

To reproduce:

curl "https://josm.openstreetmap.de/diff?term=x" -H "X-Requested-With: XMLHttpRequest"

Attachments (0)

Change History (2)

comment:1 by Jun Omae, 2 weeks ago

Component: generalversion control
Milestone: 1.6.1
Owner: set to Jun Omae
Status: newassigned
Version: 1.6

Thanks for the reporting. I noticed another trivial issue when no term parameter while reproducing it.

02:43:21 Trac[main] ERROR: [192.168.11.100] Internal Server Error: <RequestWithSession "GET '/diff'">, referrer None
Traceback (most recent call last):
  File "/home/jun66j5/venv/trac/1.6/lib/python3.11/site-packages/trac/web/main.py", line 609, in dispatch_request
    dispatcher.dispatch(req)
  File "/home/jun66j5/venv/trac/1.6/lib/python3.11/site-packages/trac/web/main.py", line 301, in dispatch
    raise e
  File "/home/jun66j5/venv/trac/1.6/lib/python3.11/site-packages/trac/web/main.py", line 247, in dispatch
    resp = chosen_handler.process_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jun66j5/venv/trac/1.6/lib/python3.11/site-packages/trac/versioncontrol/web_ui/changeset.py", line 1176, in process_request
    dirname, prefix = posixpath.split(req.args.get('term'))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 103, in split
TypeError: expected str, bytes or os.PathLike object, not NoneType

comment:2 by Jun Omae, 9 days ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Fixed in [17859] and merged in [17860].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.