Page MenuHomePhabricator

links from template not displayed
Closed, ResolvedPublic

Description

Author: richlv

Description:
if a link is coming from a template, it does not show up when editing the page in visual editor.

testcase :
https://www.zabbix.org/wiki/Docs/visual_editor_test

in the editing mode link text is not displayed.
(if creating an account to test, real name is mandatory)

used template : https://www.zabbix.org/wiki/Template:ZBXNEXT

node.js log contains :

starting parsing of localhost:Docs/visual_editor_test
<!DOCTYPE HTML PUBLIC "-IETFDTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://www.zabbix.org/mw/api.php">here</a>.</p>
<hr>
<address>Apache/2.2.22 (Linux/SUSE) Server at localhost Port 80</address>
</body></html>

error in localhost:Docs/visual_editor_test: Template Expansion failure for "{{ZBX|1}}": 301
Stack:

PreprocessorRequest._handleJSON (/home/root-rich/files/parsoid/lib/mediawiki.ApiRequest.js:415:12)
PreprocessorRequest.ApiRequest._handleBody (/home/root-rich/files/parsoid/lib/mediawiki.ApiRequest.js:189:8)
PreprocessorRequest.ApiRequest._requestCB (/home/root-rich/files/parsoid/lib/mediawiki.ApiRequest.js:166:8)
Request.self.callback (/home/root-rich/files/parsoid/node_modules/request/request.js:129:22)
Request.EventEmitter.emit (events.js:98:17)
Request.<anonymous> (/home/root-rich/files/parsoid/node_modules/request/request.js:873:14)
Request.EventEmitter.emit (events.js:117:20)
IncomingMessage.<anonymous> (/home/root-rich/files/parsoid/node_modules/request/request.js:824:12)

completed parsing of localhost:Docs/visual_editor_test in 3316 ms


Version: unspecified
Severity: normal

Details

Reference
bz63613

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:19 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz63613.

We should be able to reproduce this on a local wiki with the contents of that template.

We know of some regressions from that commit. It is is not yet deployed onto production, but yes, master has failures. https://gerrit.wikimedia.org/r/#/c/123908/ may fix it (not yet merged).

The problem here is that interwiki link is redirecting from http to https. ex.

parsoidConfig.setInterwiki('zap', 'http://www.zabbix.org/mw/api.php');

should be

parsoidConfig.setInterwiki('zap', 'https://www.zabbix.org/mw/api.php');

did you recently switch to https only?

Template expansion is trying to query the api but getting a 301 redirect in response ... which produces the error instead of following it.

richlv wrote:

if the question about https was for me, there is a redirect for http -> https, but visual editor was installed recently and this problem was there from the very beginning.

given that i'm accessing the page over https, shouldn't it work automatically ?

the only non-https connection i can see is the wgVisualEditorParsoidURL, which goes to localhost http - but i'd prefer it to stay that way (and i'm not sure whether that would help anyway :) )

richlv wrote:

that was set to http://localhost/mw/api.php

if i set it to https, in the browser i get :

Error loading data from server: parsoidserver-http-request-error: MWHttpRequest error. Would you like to retry?

and in node.js error :

TypeError: Cannot call method 'substr' of undefined

at ApiRequest._requestCB (/home/root-rich/files/parsoid/lib/mediawiki.ApiRequest.js:151:37)
at self.callback (/home/root-rich/files/parsoid/node_modules/request/request.js:129:22)
at Request.EventEmitter.emit (events.js:95:17)
at ClientRequest.self.clientErrorHandler (/home/root-rich/files/parsoid/node_modules/request/request.js:239:10)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1547:9)
at CleartextStream.EventEmitter.emit (events.js:95:17)
at SecurePair.<anonymous> (tls.js:1389:19)
at SecurePair.EventEmitter.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:982:10)

worker 808 died (8), restarting.

(i have set it back to http for now)

right, you're getting a 404 for https://localhost

try setting that to https://www.zabbix.org/mw/api.php

or, alternatively, when you visit http://localhost/mw/api.php, does that try to redirect you? change your http server configurations to allow non-https connections on localhost

richlv wrote:

oh, neat - disabling https redirect for localhost seems to have helped, huge thanks.

maybe a bit more friendly error messages can be returned in case of 301/404 errors ?

yeah, I'm working on that now based on these reports. we've recently changed the way we log data and there're still some bugs.

glad to hear it's working for you.