Bug 250699 - Preview-tab remains blank, when entering tickets
Summary: Preview-tab remains blank, when entering tickets
Status: Open
Alias: None
Product: Services
Classification: Unclassified
Component: Bug Tracker (show other bugs)
Version: unspecified
Hardware: Any Any
: --- Affects Some People
Assignee: Bugmeister
URL:
Keywords:
: 235238 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-10-28 17:59 UTC by Mikhail Teterin
Modified: 2021-03-07 18:36 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Teterin freebsd_committer 2020-10-28 17:59:51 UTC
As I type this very description, I can click on the Preview-tab to see, what the typed text will look like.

Unfortunately, the Preview is empty -- the message "Generating preview" flashes briefly, but then disappears... It used to work, but does not any more :(
Comment 1 Li-Wen Hsu freebsd_committer 2020-10-28 18:05:19 UTC
I just tested it and it works for me. I did a quick check and found it is not generated locally but through sending a request to:

https://bugs.freebsd.org/bugzilla/jsonrpc.cgi

Can you open your browser's traffic inspector and check the request/response when clicking on the preview tab?
Comment 2 Mikhail Teterin freebsd_committer 2020-10-28 18:10:58 UTC
(In reply to Li-Wen Hsu from comment #1)
> I just tested it and it works for me

I use Firefox 79.0 -- do you? Ad-blocker is disabled on FreeBSD.org.

> Can you open your browser's traffic inspector

I see POST-requests to jsonrpc.cgi -- type "XHR" -- and the HTTP-status is 200...


General
Request URL:https://bugs.freebsd.org/bugzilla/jsonrpc.cgi
Request Method:POST
Status Code:200
Started:14:07:09
Total time:772.00 ms
Request headers
Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:uk,en-US;q=0.8,en;q=0.5,ru;q=0.3
Connection:keep-alive
Content-Length:110
Content-Type:application/json
Cookie:Bugzilla_login=6XX2; Bugzilla_logincookie=XXXXX; LASTORDER=bug_status%2Cpriority%2Cassigned_to%2Cbug_id; VERSION-Ports%20%26%20Packages=Latest; VERSION-Services=unspecified; TUI=attachment_text_field=0&history_query=0&people_query=0&information_query=0&custom_search_query=0&custom_search_advanced=0&expert_fields=0
DNT:1
Host:bugs.freebsd.org
Origin:https://bugs.freebsd.org
Referer:https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250699
User-Agent:Mozilla/5.0 (X11; FreeBSD amd64; rv:79.0) Gecko/20100101 Firefox/79.0
X-Requested-With:XMLHttpRequest
Response headers
Accept-Ranges:bytes
Age:0
Connection:keep-alive
Content-Type:application/json; charset=UTF-8
Date:Wed, 28 Oct 2020 18:07:10 GMT
Server:Apache
Strict-transport-security:max-age=604800
Transfer-Encoding:chunked
Via:1.1 wfe0.nyi.FreeBSD.org
X-Cache:MISS
X-content-type-options:nosniff, nosniff
X-frame-options:SAMEORIGIN, SAMEORIGIN
X-Varnish:766704054
X-xss-protection:1; mode=block, 1; mode=block
Other
Initiator:
From cache:false
Comment 3 Michael Gmelin freebsd_committer 2021-03-01 19:35:42 UTC
This only happens when entering new bugs, not when commenting on existing bugs.

I was able to reproduce the calls to jsonrpc.cgi on the command line using curl. It seems like the problem is the missing "id" parameter in the request (again, I crossed out tokens and ids).

1. Send no id => get null in return.

curl -b "Bugzilla_login=12345; Bugzilla_logincookie=xxx;" \
  -H "Content-Type: application/json" -H "Accept: */*" \
  -d '{"version":"1.1","method":"Bug.render_comment","params":{"Bugzilla_api_token":"yyy","text":"test22"}}' \
  https://bugs.freebsd.org/bugzilla/jsonrpc.cgi
{"version":"1.1","result":{"html":null}}

2. Send id == 0 => same result

curl -b "Bugzilla_login=12345; Bugzilla_logincookie=xxx;" \
  -H "Content-Type: application/json" -H "Accept: */*" \
  -d '{"version":"1.1","method":"Bug.render_comment","params":{"Bugzilla_api_token":"yyy","id":"0","text":"test22"}}' \
  https://bugs.freebsd.org/bugzilla/jsonrpc.cgi
{"version":"1.1","result":{"html":null}}

3. Send unknown ID => error

curl -b "Bugzilla_login=12345; Bugzilla_logincookie=xxx;" \
  -H "Content-Type: application/json" -H "Accept: */*" \
  -d '{"version":"1.1","method":"Bug.render_comment","params":{"Bugzilla_api_token":"yyy","id":"9999999","text":"test22"}}' \
  https://bugs.freebsd.org/bugzilla/jsonrpc.cgi
{"error":{"message":"Bug #9999999 does not exist.","name":"JSONRPCError","code":101},"version":"1.1"

4. Send known ID => works

curl -b "Bugzilla_login=12345; Bugzilla_logincookie=xxx;" \
  -H "Content-Type: application/json" -H "Accept: */*" \
  -d '{"version":"1.1","method":"Bug.render_comment","params":{"Bugzilla_api_token":"yyy","id":"1","text":"test22"}}' \
  https://bugs.freebsd.org/bugzilla/jsonrpc.cgi
{"version":"1.1","result":{"html":"test22"}}

I guess the solution is to correct jsonrpc.cgi to work without a bug id being passed in (as it is the case with new bugs).

A quick-fix/workaround could be to change the new bug page to pass in "id":"1" (simply changing 'onclick="show_comment_preview()"' to 'onclick="show_comment_preview(1)"' might do the trick - I haven't tested this, but the javascript source of show_comment_preview indicates that this might work).
Comment 4 Mikhail Teterin freebsd_committer 2021-03-07 18:36:19 UTC
*** Bug 235238 has been marked as a duplicate of this bug. ***